In my loop below the instructions are not executed one after the other, but out of order. Some do not wait until the previous ones are finished to execute. For example all displays with echo are done in advance when it loops. I tried to put & at the end of each instruction it didn't work
My loop contains if condition
Thanks for your help.
#!/bin/bash
INPUT=Mnt.csv
OLDIFS=$IFS
IFS=','
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read dom alias port ver
do
ssh -n $alias "
echo =======================================================
echo $alias
echo =======================================================
if [ ${ver} = "v3" ]
then
instruction 1
........
........
........
instruction n
else
instruction A
........
........
........
instruction X
fi
exit" & >> $(date +%Y%m%d).log &
Aucun commentaire:
Enregistrer un commentaire