Vote count:
0
I am writing a program to match local values with remote ones. As of now, my code is functional and looks like this :
#!bin/bash
MY_ARRAY=('value1' 'value2' 'value3')
for VALUE in "${MY_ARRAY[@]}"
do
echo "$VALUE : $(ssh admin@machine matching_function $VALUE)" >> output.file
done
The only problem is that for every iteration of the loop, it creates and closes a new ssh connection. As my original dataset is quite big, it takes a long time to execute.
I was looking for a way to optimize this, and read about passing multiline commands to ssh with :
ssh admin@machine << EOF
...
#some instructions
...
EOF
However, it does not work and I get errors like Pseudo-terminal will not be allocated because stdin is not a terminal.. I suspect this is partly due to the fact my remote shell is restricted.
I am also unsure about how bash will differentiate $VALUE, which should be interpretated from my local computer, and matching_function, which should be interpretated from the remote one
Aucun commentaire:
Enregistrer un commentaire