I deal with lots of servers that often have files and folders which are not under version control. This means I can just
git remote add if I need to work with the files on my local machine.
With that in mind I often am browsing the server when I notice that I need a copy of a certain folder so I wrote this simple bash command to print the command so I can just copy it and run it on my local machine.
#!/bin/bash echo "sudo rsync -av -e ssh $(whoami)@$HOSTNAME:$(pwd) ./"
Which outputs a command like this which I can run on my home computer:
sudo rsync -av -e ssh user@hostname:/opt/lib/folder ./
Now my question is, how do I make this into a bash alias so I can add it to my user account on each of the servers?