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

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



Dear all,

I realize that this should be "way off topic", so sorry about that...

I've been working on a bash script, but when I run something like:
---------------
#!/bin/bash

echo $(pwd)
----------------
I always get $HOME, not the current working directory.  I'd need to
continue in the working directory from where the script was called to
work on the files there.  (I'd like it to be portable too, so although
it seems to work in my home machine running sarge, it doesn't work
with Fedora or OSX...)

I look at my "Classic Shell Scripting" book and glanced over the
"Advanced Bash-Scripting Guide" (by Mendel Cooper), but could not find
any reference to this.  Any help would be greatly appreciated!

Best to all,

Luis

P.S.: feel free to CC me back.



Reply to: