Last active
June 17, 2018 10:26
-
-
Save gentam/b752df409a6ae91ae50fd9a2d644a8f1 to your computer and use it in GitHub Desktop.
swap two filenames
This file contains 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 | |
[ $# -ne 2 ] && echo "Usage: $(basename $0) fileA fileB" \ | |
&& exit 1 | |
tmp="tmp$(date +%s)" | |
mv -i $1 $tmp && \ | |
mv $2 $1 && \ | |
mv $tmp $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment