Why my command of bash shell is not working? -


i add environment value in ~/.profile

export test1="abc" 

i execute bash shell script go.sh

#!/bin/bash source ~/.profile 

but result of go.sh not working.(can't find test1 variable).

set | grep test1 

otherwise when execute go.sh in command line, working. (can find test1) why go.sh not working?

when execute script, new process created own environment. when prompt back, script finished, , cannot access variables.

you have source script:

source go.sh 

if want shortcut reading profile, use alias:

alias go='source ~/.profile' 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -