I’m using a bash shell to export some path,like this:
env.sh:
export GOPATH=$GOPATH:$QBOXROOT/pili-zeus export PATH=$PATH:$QBOXROOT/pili-zeus/bin
after call sh env.sh
,I call echo $GOPATH
,but nothing output,and I call export
again to check the variables exported,but GOPATH isn’t included.But when I copy these commands in the shell file,and execute them directly in command line,it can work!why this happens?I’m using mac.
Advertisement
Answer
You need to use source env.sh
to get these variables stick to your context (i.e. terminal).
“source is a Unix command that evaluates the file following the command, as a list of commands, executed in the current context.”