new script: mvtmp

This commit is contained in:
Hedy Li 2021-08-20 20:39:58 +08:00
parent 969ab511a1
commit 0f05269487
Signed by: hedy
GPG Key ID: B51B5A8D1B176372

14
bin/mvtmp Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# This is quite a lame script, horrible actualy.
# Though it does its job. Basically it toggles the existence of a folder.
# Say there's a folder you want to temporarily remove. use mvtmp <path>,
# it will be moved to ~/tmp/<path>. Then to resotre it run mvtmp <path> again.
name=$(basename "$1")
if [[ -d ~/tmp/"$name" ]]; then
mv ~/tmp/"$name" "$1"
else
mv "$1" ~/tmp/"$name"
fi