[darcs-users] deleting a repository
Martin Ellis
m.a.ellis at ncl.ac.uk
Mon Aug 22 12:49:38 UTC 2005
On Monday 22 Aug 2005 13:15, Albert Reiner wrote:
> If this is a straw man, where do I go wrong:
Here, I think...
> - When operating on the current repo, I can see two options:
>
> - leave the user in a different directory; most likely, the one
> above the root of the repo;
I don't think this is an option.
As far as I understand, when a program is started, it gets a copy of the
current environment, including working directory. When it exits, the
programs environment, including its current working directory, are lost.
So, when you execute:
> | #!/bin/bash
> |
> | dir="`pwd`"
> | cd ..
> | rm -rf "$dir"
> | echo $?
the current directory will be 'restored' to (the nonexistant) /tmp/foo1 in
this case, as you can see:
> | $ mkdir /tmp/foo1
> | $ cd /tmp/foo1
> | $ bash /tmp/foo.sh
> | 0
> | $ pwd
> | /tmp/foo1
(I say 'restored' because actually the working directory of the interactive
shell was never changed, the shell executing the script had it's own current
directory)
On the other hand, if you don't execute a program (just source a script),
there's no environment copying, and the cd takes place in the same
environment as your top-level shell:
> | $ mkdir /tmp/foo1
> | $ cd /tmp/foo1
> | $ . /tmp/foo.sh
> | 0
> | $ pwd
> | /tmp
Martin
More information about the darcs-users
mailing list