Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!decvax!genrad!mit-eddie!godot!harvard!seismo!brl-tgr!tgr!lcc.barry@UCLA-LOCUS.ARPA From: Barry GoldNewsgroups: net.unix-wizards Subject: arguments for a command file Message-ID: <6731@brl-tgr.ARPA> Date: Fri, 21-Dec-84 17:29:41 EST Article-I.D.: brl-tgr.6731 Posted: Fri Dec 21 17:29:41 1984 Date-Received: Sun, 23-Dec-84 08:20:41 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 20 Sorry for posting this; usual problem with munged return address. cd is a built-in command to the shell. It changes the current working directory of the shell's process. It MUST be built-in; if it were fork/exec'ed like normal commands it would change the working dir of only the child process. When you execute a command file, a new shell is created in a child process to interpret the commands. The cd command affects this child process's cwd, but leaves the parent process (YOUR shell), unaffected. That's why your command file behaves so strangely. If you use the c-shell, try something like: alias change "set x = \!\$; source changescript" Then change xx will cause the script to run in YOUR shell, not a child process, and the cd command will take effect as you desire. Of course, changescript must refer to $x instead of $1. barry