If you want to keep the full path when you su use (su - user) or (su -l
user). The - or the -l options simulate a real login.
Robert
-----Original Message-----
From: slug@lists.nks.net [mailto:slug@lists.nks.net]On Behalf Of Eric
Jahn
Sent: Tuesday, March 11, 2003 1:35 PM
To: slug@nks.net
Subject: [SLUG] two simple questions about bash and the path
These two questions have annoyed me for so long I must set about
resolving them:
#1 Why does my $PATH get shrunk when I su to another user? For example:
ejahn@localhost ejahn $ echo $PATH
/usr/kde/3.1/bin:/bin:/usr/bin:/usr/local/bin:/opt/bin:/opt/sun-j2sdk-1.4.1/
jre:/usr/i686-pc-linux-gnu/gcc-bin/3.2:/usr/X11R6/bin:/opt/sun-j2sdk-1.4.1/b
in:/opt/sun-j2sdk-1.4.1/jre/bin:/usr/qt/3/bin:/usr/kde/3.1/bin:/usr/qt/2/bin
ejahn@localhost ejahn $ su root
Password:
root@localhost ejahn # echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin
root@localhost ejahn # su ejahn
ejahn@localhost ejahn $ echo $PATH
/usr/local/bin:/usr/bin:/bin
So why did the path for "ejahn" path get truncated? All I did was su
out, then back in.
#2 Why do I have to be in the exact directory to run a shell script?
Why can't I just use the full path? For example:
ejahn@localhost ejahn $ sh /opt/limewire/runLime.sh
Exception in thread "main" java.util.zip.ZipException: No such file or
directory
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:112)
at java.util.jar.JarFile.<init>(JarFile.java:117)
at java.util.jar.JarFile.<init>(JarFile.java:55)
ejahn@localhost ejahn $ cd /opt/limewire/
ejahn@localhost limewire $ sh runLime.sh
(now limewire starts fine)
Why won't bash accept a full path?
Thanks for any thoughts on these annoying things... -eric
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:49:44 EDT