Take the 2-minute tour ×  so what I'm trying to do is to write a
Bash script that will ssh into a server and generate new user
credentials. However, it won't create the new user keys, but it
can tell you if a user already exists.  echo "You entered $NAME.
Is this correct?(y/n) " read AN  while [ "$AN" != "y" ]     echo
"Enter the correct user name: "     read NAME     echo "You
entered $NAME. Is this correct(y/n)? "     read AN  ssh -t x@
<<EOF  if [ ! -e /etc/openvpn/easy-rsa/keys/"$NAME.crt" ]     cd
/etc/openvpn/easy-rsa/     source vars     ./pkitool "$NAME"
echo "File already exists!"  scp x@$NAME.crt .  This code can
generate new user keys, but when I add the if block, it then
will no longer create new keys for some reason. Anybody have any
ideas why the if block doesn't properly work?  EDIT: I solved it
share|improve this question Do you mean while loop not if loop?
–  Tom Cammann Dec 18 '12 at 22:11 @Tom Cammann The while loop
works fine for me, maybe he means the if block –  BenjiWiebe Dec
18 '1