I'm calling bash script B from script A. In script A (parent script) I am exporting some variables. I would like to use these variables in script B (subscript), but the variable values are not being passed on from script A to script B. Is there a way to access the variable values from script B?
#!/bin/bash
# script_A.sh
export VAR="value"
enter code here
sudo -u user ./script_B.sh
#!/bin/bash
# script_B.sh
echo $VAR # this prints nothing