Re: dysfunctional env?
alec1976nyc <Alec> writes:
Alec> I have the following script:
Alec> -----------------------------
Alec> #!/bin/bash
Alec> echo $PWD
Alec> -----------------------------
Alec> and I try to run it with
Alec>
Alec> env PWD=/bin script
Alec>
Alec> but it always prints the correct working directory instead of "/bin".
Alec> Why?
Because $PWD is a magic variable that's defined to work that way.
This is described in bash(1) under "Shell Variables". I'm not sure
what you're actually trying to do; running (cd /bin; ./script) (with
the parentheses) might be closer to what you want.
--
David Maze dmaze@debian.org http://people.debian.org/~dmaze/
"Theoretical politics is interesting. Politicking should be illegal."
-- Abra Mitchell
Reply to: