I have a file called "redhat_servers.txt" containing some server names line by line.
When I try to ssh to each server, and I have already done with ssh key-gen stuff. Now, for first time if I do ssh .. I need to type yes I have more than 400 servers...it will take long time to ssh to each server and type yes
You leave us guessing why you have to enter "yes". Is it in response to the question
The authenticity of host 'nnn.nnn.nnn.nnn' can't be established.
RSA key fingerprint is xx:xx:xx:xx:....
Are you sure you want to continue connecting (yes/no)?
Then you need those servers' entries in .ssh/known_hosts , and the question is gone...
So in input file server_list you can provide all servers names and while running ssh_test.ksh script it will one by one do a ssh to all the servers present in list file and will send yes to all the servers during ssh . You can change it as per your need too.
NOTE: As per your post you have done key gen already so it is only to enter yes during ssh .
One could use:
' a programs own's -y toggle' only where applicable, eg: yum update -y
Does not apply to ssh, but might for other commands - see their -h or --help output.
But also, as root: (using fdisk, since you didnt show what you tried so far)