Re: PATH and $0

2006-07-11 Thread Dave Rutherford
On 7/11/06, Cai Qian <[EMAIL PROTECTED]> wrote: I want its full pathname using 'dirname', but it will give me unexpected result on some Linux or Bash versions. Well, 'dirname' certainly won't do what you want, but I'm sorry, I can't think of a way to get what you need. (It would be relatively

Re: PATH and $0

2006-07-11 Thread Cai Qian
Hi, I want its full pathname using 'dirname', but it will give me unexpected result on some Linux or Bash versions. Qian On 7/11/06, Dave Rutherford <[EMAIL PROTECTED]> wrote: On 7/11/06, Cai Qian <[EMAIL PROTECTED]> wrote: > In some Linux, it will print "/tmp/script.sh", while in other, it wi

Re: PATH and $0

2006-07-11 Thread Dave Rutherford
On 7/11/06, Cai Qian <[EMAIL PROTECTED]> wrote: In some Linux, it will print "/tmp/script.sh", while in other, it will print "script.sh" only. Which is wrong? If both are fine, is there any better way to make it portable? Which do you want? (Both are fine.) If you want 'script.sh', use 'basen

PATH and $0

2006-07-11 Thread Cai Qian
Hi, What is the expected result of the following script? #! /bin/bash - export PATH=/tmp/ echo $0 exit 0 Then, put this file to /tmp/. cd / and run PATH=/tmp/ script.sh In some Linux, it will print "/tmp/script.sh", while in other, it will print "script.sh" only. Which is wrong? If both are