This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bash: pushd


Brendan Simon wrote:
> 
> It seems that pushd is not in the path when you run your script.
> Try putting "echo $PATH" in your script to see what the path is set to
> when the script is exectued.

`pushd' is a BASH built-in command, though--not an external programme,
so the value of $PATH shouldn't matter, so long as you're getting
bash.

Oh! I've solved it--
Note that, if I do

echo foo > a

`./a' gives `foo: not found'. Also note that *./a is not listed as
being executable*.

If we do this, however:

echo '#!'"$(type -p sh)
foo
" > b

..., then we note that `./b' will actuall run `foo', and spit out
whatever the result of doing so is. We also notice that `ls -l b'
shows b as executable!:)

If you do run into problems with the $PATH or some other variable not
being correctly known by a shell script, use `env', ie: check the
output of this:

echo '#!'"$(type -p env) sh
pushd foo
"

Direct said output into a file, find that Cygwin recognises the file
as being executable (because of the hashbang), and `pushd foo' (or
whatever else is there) is executed with the current environment,
after `sh' is found in the current PATH.


		-Rozzin.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]