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

Re: [Way OT] "#!/bin/bash" changes working directory



Dear Wesley,

> The script you've shown works fine, just the way you want. Nothing in there
> is going to change the working directory.
>
> For example:
>
> $ pwd
> /home/wjl/tmp
> $ cat <<EOF >test.sh
> #!/bin/bash
> echo $(pwd)
> EOF
> $ chmod a+x test.sh
> $ ./test.sh
> /home/wjl/tmp
>
> If you think you're having magic changing directories, I think you'll need
> to post more information, like the exact script you're using, and EXACTLY
> how you are running it. =)

OK,  I put "test.sh" in my $HOME/bin, which is in my $PATH.

Now:

babbage[~]% cd tmp
babbage[~/tmp]% test.sh
/home/finotti

Maybe is the issue with my .bashrc, as it's been pointed out...  But
is there a way around it?

Thanks!

Luis



Reply to: