On Tue, Sep 07, 2010 at 12:21:56PM -0500, Todd T. Fries wrote: > Neither of the above solutions provide the same output. > > Sorry, the requirement is to `notice' we are on a new line if an error occurs, > and only do the final echo if we are not on a new line at the end.
Another loop that should meet the requirements. ssh_keys=0 for _type in dsa ecdsa rsa rsa1; do if [ "${_type}" = "rsa1" ]; then _keyfile='/etc/ssh/ssh_host_key' else _keyfile="/etc/ssh/ssh_host_${_type}_key" fi _name=`echo "${_type}" | tr a-z A-Z` if [ ! -f "${_keyfile}" ]; then if [ "${ssh_keys}" -eq 0 ]; then echo -n 'ssh-keygen: generating new host key:' ssh_keys=1 fi echo -n " ${_name}..." if ! ssh-keygen -q -t "${_type}" -f "${_keyfile}" -N ''; then ssh_keys=0 fi fi done if [ "${ssh_keys}" -eq 1 ]; then echo fi