add bak function
This commit is contained in:
parent
3f87b59daf
commit
102e770853
1 changed files with 12 additions and 0 deletions
12
home/private_dot_config/zsh/functions/bak
Normal file
12
home/private_dot_config/zsh/functions/bak
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env zsh
|
||||
##? append date/time and `.bak` to file
|
||||
|
||||
local now f
|
||||
now=$(date +"%Y%m%d-%H%M%S")
|
||||
for f in "$@"; do
|
||||
if [[ ! -e "$f" ]]; then
|
||||
echo "file not found: $f" >&2
|
||||
continue
|
||||
fi
|
||||
cp -R "$f" "$f".$now.bak
|
||||
done
|
Loading…
Reference in a new issue