Re: [Way OT] "#!/bin/bash" changes working directory
Try:
#!/bin/sh
export PWD
echo $PWD
Gilberto
On Thu, 5 Jan 2006 14:25:10 -0500
Luis Finotti <luis.finotti@gmail.com> wrote:
> 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: