Bash scripts

A bash script is a text file containing a series of commands executed in order, which automates a repetitive task. It starts with a #!/bin/bash line, can use variables, conditions and loops, and must be made executable to be run.

Example

#!/bin/bash
for f in *.txt; do
  echo "$f"
done

Related concepts

The whole glossary