bash – WHILE loop – read line of a file one by one — Not working the No. of times the file has lines in it
You might want to add the
-n option to the ssh command. This would prevent it to swallow your inputfile.txt as its standard input.
Alternatively, you might just redirect ssh stdin from /dev/null, eg:
somevariable=$(ssh sshuser@sshserver hostname </dev/null);