[Top][All Lists]

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

Re: [Help-bash] flummoxed

From: Eric Blake
Subject: Re: [Help-bash] flummoxed
Date: Thu, 09 Oct 2014 07:00:21 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

On 10/09/2014 06:52 AM, Federico Prades Illanes wrote:
> I'm just guessing here, is is possible that your script is using the cd
> built-in. The default behaviour is to change the directory back to $HOME,
> so you might be doing this accidentally, for example as cd $NOTSET.

The script itself is not doing that.

> It will also help to send the contents of your 'If' script.

He did:

>> tmp$which lf
>> /usr/local/bin/lf
>> tmp$cd /usr/local/bin
>> bin$cat lf
>> for f in *; do [[ -d "$f" ]] || echo "$f"; done
>> bin$cat lfx
>> set -x
>> for f in *; do [[ -d "$f" ]] || echo "$f"; done
>> bin$cd

I don't see anything in your script that is changing directory, but I
_highly_ suspect that you have something else, such as $ENV, or an old
version of bash that is vulnerable to 'x=() { :;}; cd' accidentally
executing 'cd' as the first thing during bash startup.

Try running 'bash -vx lf' to see if that gives you more hints about code
being run prior to the start of your script.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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