Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #! /usr/bin/bash
  2.  
  3. # copies local directory to $HOME/directory remotely
  4.  
  5. # $1 = path to directory locally
  6. # $2 = remote hostname to copy to
  7.  
  8. export BZIP="--best"
  9.  
  10. tar -cjvf /tmp/$1.tar.bz2 $1
  11. scp /tmp/$1.tar.bz2 $2:/tmp/$1.tar.bz2
  12. rm /tmp/$1.tar.bz2
  13. ssh "$2" "cd \$HOME; tar -xvjf /tmp/$1.tar.bz2 && rm /tmp/$1.tar.bz2"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement