Scripting

A shell script lets you write shell commands to run in sequence, which can save time and reduce errors.

Create a shell file

touch yourscript.sh

Open the file in any editor and write shell commands (one per line).

Permissions

The file must have execute permissions to run:

chmod +x /path/to/yourscript.sh

Execute

Run the shell script:

# From anywhere
/path/to/yourscript.sh

# From current directory
./yourscript.sh