Tom's wiki

Shell

A program that interprets user commands.

POSIX shell:

#todo https://en.wikipedia.org/wiki/Shebang_(Unix)

✏️ Note
In most shells && and || have the same precedence.

💡 Hint
Add & at the end of a command to run it in the background.

Best practices

More: https://github.com/SixArm/unix-shell-script-tactics

Glob patterns

Sourcing vs Executing

Sourcing a script (. script.sh) will run its commands in the current shell process. Changes to the environment are visible in the current shell.

Executing a script (./script.sh) will run its commands in a new shell process. Changes to the environment are not visible in the current shell and lost when the script is finished.