Allow bak to support multiple files at once

This commit is contained in:
ViViDboarder 2021-12-14 18:07:16 -08:00
parent 46a1d63970
commit 62d4d54ccc
1 changed files with 8 additions and 8 deletions

View File

@ -1,10 +1,10 @@
#! /bin/bash
f="$1"
ext="${f##*.}"
if [[ "$ext" == "bak" ]]; then
cp "$f" "${f%.*}"
else
cp "$f" "${f}.bak"
fi
for f in "$@"; do
ext="${f##*.}"
if [[ "$ext" == "bak" ]]; then
cp "$f" "${f%.*}"
else
cp "$f" "${f}.bak"
fi
done