hehe silly script
Signed-off-by: Ferit Yiğit BALABAN <fyb@fybx.dev>
This commit is contained in:
parent
7f4d328d77
commit
adbbbe04dd
28
bak
Executable file
28
bak
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage:
|
||||
# ./bak [-v] [filename] [filename] ...
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Usage: $0 [filename] [filename]..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" == "-v" ] || [ "$1" == "--version" ]; then
|
||||
echo "what version? this is a tiny little script, sir"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
||||
echo "Usage: $0 [filename] [filename]..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for file in "$@"; do
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$file.bak"
|
||||
echo "Backed up $file to $file.bak"
|
||||
else
|
||||
echo "file '$file' does not exist"
|
||||
fi
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user