bug-bash
[Top][All Lists]
Advanced

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

Re: PATH and $0


From: Andreas Schwab
Subject: Re: PATH and $0
Date: Sat, 12 Aug 2006 10:12:08 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

address@hidden (Bob Proulx) writes:

>> 2- word splitting when IFS contains non-blank characters varies
>> from one shell to the next, and in most implementations
>> (including bash and AT&T ksh, it differs from the way the shell
>> splits $PATH internally to look up a command ("/bin:" is "/bin"
>> and "" as far as PATH look up is concerned
>
> Negative.  In AT&T ksh (and others) "/bin:" is "/bin" and "." for PATH
> lookup.
>
>> while bash world splitting splits "/bin:" into only "/bin").
>
> Negative.  In bash "/bin:" is "/bin" and "." for PATH lookup.

The point is that word splitting does not preserve the empty element at
the end, thus it differs from PATH lookup.

$ (PATH=/bin:; IFS=:; for x in $PATH; do echo "$x"; done) | wc -l
1

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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