I am trying to run a for loop which looks something like thiscat  all_data |  awk '{print $1  $2  $3}'  |  while read inst type serial ; do    echo $inst    if [ `echo ${inst} | cut -d '-' -f2` = H3 ]; then      ssh  -t  username@hostname3 sudo ls    elif [ `echo ${inst} | cut -d '-' -f2` = H2 ] ; then      ssh  -t  username@hostname2 sudo ls    elif [ `echo ${inst} | cut -d '-' -f2` = H1 ]; then      ssh  -t  username@hostname1 sudo ls    fi  doneI am not able to run the ssh -t part,it says psuedo terminal will not be allocated becasued stdin is not a terminalsudo: no tty present and no askpass program specifiedI have tried with -t -t and -n, no luck.I cant edit the visudo file from the host i am running this command from.Edit$ cat all_dataABC-DIF2    DELL-800    60999ABC-DIF3    HP-DL340    J0777ABC-DIF4    DELL-800    P0087...The all_data contains 1000's of the similar entries.What i am trying to do it as follows.60999,J0777... are the entities on which i need to run commands on.So i am trying to read each line, split up and check what is the DIF number corresponding to the entity.eg If i read DIF2, it means that i need to ssh into hostname2 and run the command to get data on the 60999If if i read DIF3, it means for the entity J0777 can only be run from hostname3.
cannot remote command with ssh over for loop
ssh