[plug] bash bodgy

Bernard Blackham bernard at blackham.com.au
Sat Jun 5 19:56:46 WST 2004


On Sat, Jun 05, 2004 at 07:41:55PM +0800, Craig Dyke wrote:
> I WANT to be in 'home' when script completes.
> After googling I found info to say that if I put either of the following:
> 
> source cd ${home}

When you source a script (or use .), it runs the commands in the
current shell. What you're after is to have a shell script that
contains the line "cd $HOME", and source (or .) the script. Else
what happens is the chdir is performed in a separate process which
then exits.

eg:

--gohome.sh--
cd $HOME
----

and then:
source gohome.sh
or
. ./gohome.sh

This means you'll need to consciously execute the script by putting
a . or "source" in front of the script name.

> When I run the script I get the following message:
> 
> ./tt: line 5: cd: No such file or directory

It's looking for the script called cd which doesnt actually exist.

HTH,

Bernard.

-- 
 Bernard Blackham <bernard at blackham dot com dot au>



More information about the plug mailing list