changing dir inside shell

Steve Lane steve at geac.UUCP
Thu Jul 28 22:37:38 AEST 1988


In article <47800013 at uxe.cso.uiuc.edu> bianco at uxe.cso.uiuc.edu writes:
>
>I have the following in a file called 'mover':
> cp *.me /usr/tmp
> cd /usr/tmp 
>Upon entering 'sh mover' the files are copied, and the directory is
>changed, however the shell is then exited and the current directory
>is changed back to my home directory. How can I cause the shell to exit
>in the directory I changed to ? 
>

Try using either of the following:

	. mover            -- instead of 'sh mover'
or	source mover       -- instead of 'csh mover'

Each of these statements executes the commands in 'mover' in the current
shell rather than firing up a sub-shell. You can also change shell
variables in a similar manner.

Steve.

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Steve Lane,                        UUCP: ...[mnetor, yunexus, utgpu]!geac!steve
Software Solutions                 (416) 221-2830
108-755 Steeles Ave W, Willowdale, Ontario, M2R 2S6.



More information about the Comp.unix.questions mailing list