Setting environment variable in shell script does not make it visible to the shell
By : Moh
Date : March 29 2020, 07:55 AM
hop of those help? This is how environment variables work. Every process has a copy of the environment. Any changes that the process makes to its copy propagate to the process's children. They do not, however, propagate to the process's parent. One way to get around this is by using the source command: code :
source ./test.sh
. ./test.sh
|
accessing environment variable in python script when called from a shell script differs from running it in the shell dir
By : user3649588
Date : March 29 2020, 07:55 AM
|
How can I delete a specific variable from my PATH environment variable using fish shell
By : Jean-Pierre Lacroix
Date : March 29 2020, 07:55 AM
around this issue This is rather easy to do in fish. With set -e, you can erase not just entire variables, but also elements from lists, like set -e PATH[2] to delete the second element (fish counts list indices from 1). code :
function deleteFromPath
# This only uses the first argument
# if you want more, use a for-loop
# Or you might want to error `if set -q argv[2]`
# The "--" here is to protect from arguments or $PATH components that start with "-"
set -l index (contains -i -- $argv[1] $PATH)
# If the contains call fails, it returns nothing, so $index will have no elements
# (all variables in fish are lists)
if set -q index[1]
set -e PATH[$index]
else
return 1
end
end
|
Yocto bitbake configuration for MACHINE variable via shell environment variable
By : imtiaz
Date : March 29 2020, 07:55 AM
I wish this help you The answer as usual with bitbake is "it depends" but usually in the case of MACHINE, the environment variable wins. The preference depends on how the configuration file sets the variable. Typically MACHINE is set with soft assignment (e.g. MACHINE ?= "intel-corei7-64") and soft assignment will not override a environment variable. A normal assignment (MACHINE = "intel-corei7-64") would not respect the environment variable.
|
Can't access shell variable in perl script unless it's an environment variable
By : Mike L.
Date : March 29 2020, 07:55 AM
may help you . You are not getting the value of AAA variable because AAA is local env variable where as BBB is exported variable. Exported variables are carried into the environment of processes started by the shell that exported them, while non-exported variables are local to the current process only. code :
$ set AAA=123
$ csh
$ echo $AAA
AAA: Undefined variable.
$ exit
$ setenv BBB 456
$ csh
$ echo $BBB
456
|