[Gllug] Why does this script not work?

Nix nix at esperi.demon.co.uk
Sat Dec 15 21:22:31 UTC 2001


On Tue, 11 Dec 2001, tet at accucard.com muttered drunkenly:
> 
>>> append :
>>> exec /bin/bash
>>> 
>>> is one option.
>>
>>This would give you a new subshell every time you ran that script; if it
>>was used anything like `cd', you'd end up with about a hundred million
>>subshells to exit back out of.
> 
> Errr.... no. That's what the "exec" is for. But there are other reasons

Errr... yes. It's already forked a subshell to handle the shell script
(assuming the script was run, rather than sourced), so despite the
replacement via `exec', you'll get one extra subshell per invocation.

> Tet (confused as to why typing "cd .." is so hard anyway...)

... and why writing shell functions to do the changing rather than shell
scripts is so hard...

-- 
`The situation is completely under control. All of them were killed.'
     --- Alim Razim, for the Northern Alliance, demonstrating fine
         command of traditional Afghan prisoner control techniques.

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list