Skip to content

Instantly share code, notes, and snippets.

@andrewytliu
Created June 22, 2011 11:57
Show Gist options
  • Save andrewytliu/1039941 to your computer and use it in GitHub Desktop.
Save andrewytliu/1039941 to your computer and use it in GitHub Desktop.
Swap files or directories
#!/bin/bash
DEST=$1
FILE=${DEST%/}$RANDOM
mv $1 $FILE
mv $2 $1
mv $FILE $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment