Path: utzoo!yunexus!geac!steve From: steve@geac.UUCP (Steve Lane) Newsgroups: comp.unix.questions Subject: Re: changing dir inside shell Message-ID: <3090@geac.UUCP> Date: 28 Jul 88 12:37:38 GMT Article-I.D.: geac.3090 References: <47800013@uxe.cso.uiuc.edu> Reply-To: steve@geac.UUCP (Steve Lane) Organization: Software Solutions Lines: 27 In article <47800013@uxe.cso.uiuc.edu> bianco@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.