Created
November 22, 2018 01:39
-
-
Save jraleman/c48d11805eadf3089cc6db20f11cc38a to your computer and use it in GitHub Desktop.
Swap two file from one location to another location
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -ne 2 ] ; then | |
echo "usage: $0 source_file target_file" ; | |
exit 1 ; | |
else | |
[ -e $1 ] && [ -e $2 ] | |
tmp=$(mktemp) | |
mv -fv $1 $tmp | |
mv -fv $2 $1 | |
mv -fv $tmp $2 | |
exit 0 ; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment