LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   bash - script not see environment variable running under sudo (https://www.linuxquestions.org/questions/linux-software-2/bash-script-not-see-environment-variable-running-under-sudo-4175411764/)

jfjh201 06-16-2012 06:06 AM

bash - script not see environment variable running under sudo
 
my script contains string

Code:

echo $myvar
here's what i do in terminal

Code:

$ export myvar=1
$ ./myscript.sh
1
$ sudo ./myscript.sh

$

under sudo script does not see variable. how do i fix it?

lithos 06-16-2012 06:34 AM

if you have "sudo" calling the script, but you define the VAR not in sudo environment then it can't follow it.
You will need some sudo configuration

good luck


All times are GMT -5. The time now is 04:28 PM.