timerring

Shell Scripting Fundamentals

July 25, 2022 · 23 min read
Tutorial
Shell | VPS

Shell is the language we use to communicate with the operating system through the command line.

Shell scripts can run directly on the command line, or a set of logic can be organized into a file for reuse. The command line can be thought of as a “shell script executing line by line.”

There are many common kinds of shell scripts in Linux, including:

  • Bourne Shell (/usr/bin/sh or /bin/sh)
  • Bourne Again Shell (/bin/bash)
  • C Shell (/usr/bin/csh)
  • K Shell (/usr/bin/ksh)
  • zsh
  • …

Linux systems generally use bash by default.

The file should begin with #! /bin/bash to specify bash as the script interpreter.

...