arguments for a command file
Snoopy
seifert at mako.UUCP
Sat Dec 22 03:13:28 AEST 1984
> 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 !!!
\___/
More information about the Comp.unix.wizards
mailing list