Shell script termination with exit function in backquotes
RW
rwmaillists at googlemail.com
Tue Mar 22 12:32:51 UTC 2011
On Sat, 19 Mar 2011 09:44:57 -0700
Devin Teske <dteske at vicor.com> wrote:
> At least two variations to the rule that { ... } is a block of
> commands executed in the current shell are:
>
> 1. When the block appears as a function
Is that correct? I'd assumed that functions do execute in the current
shell since you can alter variables from a function, whilst you can't
from a "()".
e.g.
--------------------------------------------------------------------
$ cat /tmp/foo
#!/bin/sh
f (){
x=2
}
x=1
f
echo $x
( x=3 )
echo $x
--------------------------------------------------------------------
$ /tmp/foo
2
2
More information about the freebsd-questions
mailing list