Some cleaning, adds bashrc for those who don't want / can't install zsh
This commit is contained in:
21
bin/swap
Executable file
21
bin/swap
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Swap files
|
||||
if [ $# -ne 2 ]; then
|
||||
echo -e "\033[1;31merror:\033[0m expected two arguments"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f $1 ] && [ -f $2 ]; then
|
||||
tmp=`mktemp`
|
||||
mv "$1" "$tmp"
|
||||
mv "$2" "$1"
|
||||
mv "$tmp" "$2"
|
||||
elif [ -d $1 ] && [ -d $2 ]; then
|
||||
tmp=`mktemp -d`
|
||||
mv "$1" "$tmp"
|
||||
mv "$2" "$1"
|
||||
mv "$tmp/$1" "$2"
|
||||
else
|
||||
echo -e "\033[1;31merror:\033[0m expected two files or two directories"
|
||||
fi
|
||||
Reference in New Issue
Block a user