29
13
Can you scp
a file to multiple locations in the same command?
For example:
scp file.txt user@ip-1.com:, user@ip2.com:
Or would it be more practical to create a bash script that has all the hosts already in it and it would just take a file as the argument?
I'm doing the former, but with rsync and some of my nodes are not updating. Any idea why? – Soubriquet – 2018-09-22T17:50:01.413
This works! Still a handful to type out though. Perhaps there's a way to simplify that. – Andrew – 2011-09-22T21:02:08.503
2@Andrew, if you change the
for
-loop intowhile read dest; do
, it will read from standard input. Put it in a script and feed thedestfile.txt
into it (e.g.,./thescript.sh <destfile.txt
). – Kusalananda – 2011-09-22T21:19:16.507