$cat test
export var=value
$source ./test
$cat print.sh
echo $var
$chmod +x print.sh
$echo $var
value
$sudo ./print.sh
I get nothing. I was expecting to see value.
What is going on?
|
if you want to keep the environment with a sudo, use If you need to always preserve some of your environment variables, edit the sudoers file to add lines :
|
|||
|
|
$ ./print.sh(without sudo) showsvalue? – Didier Trosset Oct 27 '11 at 11:55