Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # A script to 'swap' two file names
  4.  
  5. set -euo pipefail
  6.  
  7. if [[ $# -ne 2 ]];
  8. then
  9. echo "Two arguments required: File1 File2"
  10. exit 1;
  11. fi
  12.  
  13. echo -n "Swapping $1, $2"
  14. temp=$(mktemp)
  15.  
  16. mv "$1" "$temp"
  17. mv "$2" "$1"
  18. mv "$temp" "$2"
  19. echo ": DONE"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement