and another file
exec < $1
while read line
do
ssh root@172.16.1.$line
done
while running the command
sh file.sh ab
output display as shown
Pseudo-terminal will not be allocated because stdin is not a terminal. root@172.16.1.81's password:
after writinfg password but it will not run.........
redirects all script input from whatever $1 is. Thus, any programs started by this script will also be redirected to whatever $1 is. Your starting ssh in interactive mode, which shouldn't take input from a non-terminal.
You don't need this exec line:
cat $1 |
while read line
do
ssh ....
done
Or maybe you want to use ssh to execute a command and not run interactively. Is that the case?