Hi. I run the following script in bash 3.2.48:
#!/bin/bash
export var1='var1'
echo "UID=$UID"
if [ x"$UID" != x"0" ]
then
export var2='var2'
while ! { sudo -v; }; do { sudo -v; }; done;
sudo $0
exit
fi
echo $var1
echo $var2
exit 0
What I get as output is:
UID=1000
UID=0
var1
My question: Why is var2 not exported and echoed? Does that make sense? I'm pretty sure that the same script worked with older bash versions.
Tanks for any help. Chris