Created
July 17, 2018 11:41
-
-
Save capJavert/c8512b25f7792a554335dad399d5033b to your computer and use it in GitHub Desktop.
Swap function for linux shell.
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
# https://stackoverflow.com/a/1115909 | |
function swap() | |
{ | |
local TMPFILE=tmp.$$ | |
mv "$1" $TMPFILE && mv "$2" "$1" && mv $TMPFILE $2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment