1

I have a text file which which contain sets of ssh commands.
How can I execute those commands in ssh? and get command executed one by one?

my file name is: urllist.txt
Inside urllist.txt I have following commands:

wget -O file1.f url1
wget -O file2.f url2
wget -O file3.f url3
# about thousands of links.

How can I execute them one by one in ssh?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
decoded
  • 25
  • 4

1 Answers1

0

You can try and make your text file a script, made for executing those commands on the remote machine.

In order to run that script in a remote ssh session, you can refer to "how to use ssh to run shell script on a remote machine?"

If the rmeote machine is a Unix one:

ssh root@MachineB 'bash -s' < local_script.sh

A more complete solution would use the python (client side) tool Fabric.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250