Files
bash-programming-from-scratch/manuscript/resources/code/BashScripting/make-backup-if.sh
2020-10-17 10:22:39 +02:00

12 lines
235 B
Bash

#!/bin/bash
if ! bsdtar -cjf "$1".tar.bz2 "$@"
then
echo "bsdtar - FAILS" > results.txt
exit 1
fi
echo "bsdtar - OK" > results.txt
mv -f "$1".tar.bz2 /d && echo "cp - OK" >> results.txt || ! echo "cp - FAILS" >> results.txt