Local scope variables
# local makes variables local.
function thing { local l=8;echo $l;}
l=3
echo $l
3
thing
8
echo $l
3
...
# declare does exactly the same thing.
function thing { declare l=8;echo $l ;}
l=3
echo $l
3
thing
8
echo $l
3
...
# otherwise variables are global even inside functions.
function thing { l=8;echo $l ;}
l=3
echo $l
3
thing
8
echo $l
8
Comments
Post a Comment