Search⌘ K
AI Features

Poor Technical Solution

Explore the drawbacks of relying on the Bash history file to store complex backup commands, including size limits and search inefficiencies. Learn why permanent storage needs require more robust solutions and how Bash scripting features can address these challenges.

Saving our commands

Our following backup command became long and complex after applying all improvements:

(tar -cjf ~/photo.tar.bz2 ~/photo &&
  echo "tar - OK" > results.txt ||
  ! echo "tar - FAILS" > results.txt) &&
(cp -f ~/photo.tar.bz2 ~/backup &&
  echo "cp - OK" >> results.txt ||
  ! echo "cp - FAILS" >> results.txt)

Therefore, we should store it somewhere. Otherwise, we have to type the command in the terminal window each time. Typing is ultimately a bad idea because we can make a mistake ...