Date: Fri, 13 Sep 1996 14:00:46 -0600 From: Sean Kelly <kelly@fsl.noaa.gov> To: hmmm@alaska.net Cc: freebsd-questions@freebsd.org Subject: Re: several Message-ID: <199609132000.UAA12200@gatekeeper.fsl.noaa.gov> In-Reply-To: <323A122F.34B@alaska.net> (message from hmmm on Fri, 13 Sep 1996 19:02:23 -0700)
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> hmmm <hmmm@alaska.net> writes: > 1. how do you execute a sh cmd in a script - in your login shell? > i'd like to "cd" in a script, and i want to be "there" when the > script ends. It's impossible because a script runs as a separate process and each process has its own working directory. But, if the shell itself executed the script, rather than as a separate process, then it's possible. If you're running csh/tcsh, do: source <script-name> and <script-name> should be a csh script. If you're running sh/ksh, do: . <script-name> (note the space after the dot) and here, <script-name> should be a Bourne script. In either case, the commands in <script-name> are executed by the current shell instead of in a subprocess. Yet another alternative is for the <script-name> to print to standard output the name of the directory you want to end up in; then you just have to do: cd `<script-name>` Now, <script-name> can be any kind of script and it can be run from either kind of shell. > 3. why do i see so many "xerox"ed messages here? i like 2 for the > price of 1, except when it comes to e.mail! :) Heh, heh ... it's because when I reply to your message, your email address is in the `To:' list, so you see a copy right away. But then `freebsd-questions' is the the `Cc:' list, and since you're on the freebsd-questions list, you get a second copy at a later time. :-) --k
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609132000.UAA12200>