Re: [SLUG] two simple questions about bash and the path

From: Joe Burnsworth (jburnsworth@earthlink.net)
Date: Tue Mar 11 2003 - 14:05:15 EST


When you su again, you are logging into that account *again*..

Try typing exit to get back to your initial login.

-Joe

On 11 Mar 2003, Eric Jahn wrote:

> 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/bin:/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
>
>

_UPTIME_



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:49:26 EDT