Bash scripts: running, variables, arguments
cheat sheet · Ubuntu 24.04 · bash 5.2 https://lab.dimsanych.ru/en/wiki/bash-scripting/Cheat sheet
-
#!/bin/bash # first line: what runs the file -
set -euo pipefailstop at the first error -
chmod u+x backup.shallow running it -
./backup.sh "my file.txt"run it by path -
bash backup.shrun it without the x bit -
bash -n backup.shcheck syntax without running -
name="value"; echo "$name"a variable — in double quotes -
for f in "$@"; do echo "$f"; doneevery argument, one at a time