I'm trying to write a bash script to automatically run a go get/install in different directories. The relevant part is here:
( cd ../web ; go get )
( cd ../web ; go install )
( cd ../services ; go get )
( cd ../services ; go install )
When I execute the script, I get this though:
- cd ../web
- go get
./staging.sh: line 43: go: command not found - cd ../web
- go install
./staging.sh: line 44: go: command not found - cd ../services
- go get
./staging.sh: line 45: go: command not found - cd ../services
- go install
./staging.sh: line 46: go: command not found
If I just go to the directories manually and run the commands, they work fine. Why aren't they executing when running from the script?
goin the $PATH ?printenv | grep PATHto your script and making sure thegobinary is in one of the folders listed. If you just installed go, try starting a new terminalPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binWhich is different than if I run grep the path when I go to the file. So it probably is a path issue. How can I make the script get the correct path?echo $SHELLproduce the same result when you run it in your interactive shell and your script? It might be that you are loading a different shell and that's not loading the .*rc file where your $PATH is getting properly set.