[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is this intended behavior??
From: |
Bruce Korb |
Subject: |
Re: Is this intended behavior?? |
Date: |
Wed, 13 Feb 2013 09:17:05 -0800 |
Hi,
On Wed, Feb 13, 2013 at 9:01 AM, Chet Ramey <chet.ramey@case.edu> wrote:
> On 2/11/13 2:25 PM, Bruce Korb wrote:
[...]
>>> /tmp/ZZ/a/b/c /tmp/ZZ/a /tmp/ZZ
>>> /tmp/ZZ/a/b/c
>>> $ popd /var/tmp
>>> /tmp/ZZ/a/b/c /tmp/ZZ/a
>>> /tmp/ZZ/a/b/c
>>> $
>>
>> It is behaving as if it were seeing the "-0" option.
>
> It's unspecified behavior. popd doesn't take any `non-option' arguments.
> As soon as you specify one, you can't really expect to know what will
> happen without experimentation or reading the source.
Not my source. I was trying to replace crufty code. :)
> /var/tmp gets translated to the equivalent of -0 (if you're curious, it's
> because `/' isn't `+' and the default directory index is 0).
>
> It should probably be an error instead.
Perfect! I was editing someone else's code and replacing pushd/popd with
cd $dir/cd $OLDPWD when I discovered this bizarre behavior because someone
had coded up "popd $WORKDIR" with that work directory being a full path.
I replaced that with "cd $OLDPWD" and the script failed.
Either an error or ignore the thing, just not something unanticipatable. :)
Thank you! - Bruce