Skip to main content

BASH | General commands


When running bash scripts, you can include other commands on the same line by using these at the end of each "line" command.

bash:

A; B    # Run A and then B, regardless of success of A
A && B  # Run B if and only if A succeeded
A || B  # Run B if and only if A failed
A &     # Run A in background.

Example:
apt install vim -y A && B apt update vim -y

Running a bash script file .sh:

sh scriptfilename.sh

If you get a "Permission denied" error,  either run  "sudo" or you may need to make the script executable by running 

chmod +x scriptname.sh