Skip to content

Instantly share code, notes, and snippets.

@gentam
Last active June 17, 2018 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gentam/b752df409a6ae91ae50fd9a2d644a8f1 to your computer and use it in GitHub Desktop.
Save gentam/b752df409a6ae91ae50fd9a2d644a8f1 to your computer and use it in GitHub Desktop.
swap two filenames
#!/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