[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATH and $0

From: Cai Qian
Subject: Re: PATH and $0
Date: Tue, 11 Jul 2006 17:29:19 +0100


I want its full pathname using 'dirname', but it will give me
unexpected result on some Linux or Bash versions.


On 7/11/06, Dave Rutherford <address@hidden> wrote:
On 7/11/06, Cai Qian <address@hidden> 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 'basename' or the Bash equivalent, which I think is '${0##*/}'.
The canonical path would be a bit trickier.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]