Command not found on bash script
8,675
The PATH variable is used to find all commands your script will use but rather than adding new directories to it you have overwritten it with a single directory, replace your second line with the following:
PATH=$PATH:/var/lib/cloud9/autorun/loginbrillo
PATH is a colon seperated list, this will get the current value of PATH, append a colon to it and add your directory to it
Related videos on Youtube
Author by
Ichrak Mansour
I am Full stack engineer with more than 4 years of experience and solid experience in Fullstack and Mobile development. I like to build websites and mobile applications that can have a large satisfied user-base, delight and inspire people.
Updated on September 18, 2022Comments
-
Ichrak Mansour over 1 year
I want to run a bash script to access two terminal tabs, each run
cd "folder"
, then"npm run start"
, as below:#!/bin/bash sudo mysql -u root -h localhost PATH=/var/lib/cloud9/autorun/loginbrillo tmux new-session -d -s session1 "cd $PATH/backend && npm run start" & tmux new-session -d -s sessionn1 "cd $PATH/frontend && npm run start" & chromium-browser http://192.168.7.2:4001/
When I run it, I get :
tmux: command not found npm: command not found chromium-browser: command not found
How to fix it please ?
-
steeldriver almost 6 yearsDon't use all-caps for your shell script variables - they are (informally) reserved for system environment variables. In this case, you've overwritten your shell's executable search path
PATH
- which is why no programs are being found. Just change the variablePATH
to something else likecloudpath
-
-
steeldriver almost 6 yearsThe OP appears to be using
PATH
as a working directory variable, not an executable search path -
Ichrak Mansour almost 6 yearsGreat ! I get just :
chromium-browser: command not found