scripts

My personal collection of scripts
git clone git://src.gearsix.net/scripts
Log | Files | Refs | Atom | README | LICENSE

commit 360f9b5e7d4c0794faf3d30848e362d07283cd76
parent 22208ab1ab853f84d84377d345aced6a0d1f71e8
Author: gearsix <gearsix@tuta.io>
Date:   Tue, 26 Apr 2022 09:50:02 +0100

backup: fixed some shellcheck errs, changed -r to -m

Diffstat:
Mnix/backup.sh | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/nix/backup.sh b/nix/backup.sh @@ -9,12 +9,10 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo "copy all listed files (in FILEPATHS...) to \$filename.bak" echo "" echo "OPTIONS (must be provided before FILEPATHS...)" - echo " -r move files instead of copying them, removing the original" + echo " -m move files instead of copying them, removing the original" exit fi -backup=cp -if [ "$1" = "-r" ]; then backup=mv; fi - -for f in ${@}; do $backup $f $f.bak; done - +alias backup='cp' +if [ "$1" = "-m" ]; then shift; alias backup='mv'; fi +for f in "${@}"; do backup "$f" "$f.bak"; done