Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site mako.UUCP
Path: utzoo!linus!decvax!tektronix!orca!mako!seifert
From: seifert@mako.UUCP (Snoopy)
Newsgroups: net.unix,net.unix-wizards
Subject: Re: arguments for a command file
Message-ID: <468@mako.UUCP>
Date: Fri, 21-Dec-84 12:13:28 EST
Article-I.D.: mako.468
Posted: Fri Dec 21 12:13:28 1984
Date-Received: Sun, 23-Dec-84 05:46:28 EST
References: <2650@dartvax.UUCP>
Distribution: net
Organization: The Daisy Hill Puppy Farm
Lines: 37
Xref: mako net.unix:2962 net.unix-wizards:6229


> I print the pwd in the command file and it prints the expected one.
> On using the command pwd outside the command file I find that the
> change in the directory has not been made.
> Why does it do this?

When you execute the command file, a child process is set up.
The current directory *in the child process* is in fact
getting changed, but this does not effect the current directory
in the parent process.

If you in fact want the command file to change the current directory
in the parent process (normally your login shell), you have to
get the shell to *not* set up a child process to execute the
command file. This is done with the dot command.

e.g.:

$ pwd
/usr
$ . command_file include
$ pwd
/usr/include
$

This also applies if you want to set shell variables from
a command file.

Just tried this, and $1 will get the argument if you don't use
the dot command, but doesn't when you do.  Very strange. Might be
a Berkelyism, but I no longer have access to sys V to compare with.

        _____
	|___|		the Bavarian Beagle
       _|___|_			Snoopy
       \_____/		tektronix!tekecs!seifert <- NEW ADDRESS !!!
        \___/