Answer the question
In order to leave comments, you need to log in
How to substitute each line into the execution of a command from a BASH file?
I want to connect to each computer on the network and execute the same command (pdsh is not suitable), so I decided to write a script
#!/bin/bash
FILE=$1
while read LINE; do
sshpass -p 123456 ssh -o UserKnownHostsFile-/dev/null -o StrictHostKeyChecking=no [email protected]$LINE 'date'
done < $FILE
Answer the question
In order to leave comments, you need to log in
for fl in `cat $1`; do
sshpass -p 123456 ssh -o UserKnownHostsFile-/dev/null -o StrictHostKeyChecking=no [email protected]$fl 'date'
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question