delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/07/15/21:25:19

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <378E8996.F476B541@geekspace.com>
Date: Thu, 15 Jul 1999 21:23:34 -0400
From: Joshua Rosen <rozzin AT geekspace DOT com>
Organization: GEEKS
X-Mailer: Mozilla 4.61 [en] (WinNT; U)
X-Accept-Language: en,ja,no
MIME-Version: 1.0
To: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: bash: pushd
References: <Pine DOT BSF DOT 4 DOT 05 DOT 9907160230050 DOT 15929-100000 AT mail DOT kolej DOT mff DOT cuni DOT cz> <378E8172 DOT 42692CCB AT dgs DOT monash DOT edu DOT au>

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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019