Hi Johnny, On Tue, Jan 13, 2009 at 03:28, blazt wrote: > > I am not sure how to do a except script. I have been looking at what I can > find on the net.
It is 'expect', not 'except'. It's enough to read 'man expect' for basics. You'll have to learn some Tcl docs for advanced usage, (not required for ssh-host-config automation). > Would I pass this command into the except part? See an excerpt from my expect script below. I don't provide the full version, as it is complicated more than necessary for the demonstration due to support of different OSes and corner cases. (Also it was not verified with the latest ssh-host-config.) #!/bin/expect -f # required on Win2k3 exec chmod +r /etc/passwd exec chmod +r /etc/group exec chmod +x /var spawn ssh-host-config # Host keys generation is lengthy procedure set timeout 20 expect { "Overwrite existing /etc/ssh_config file? (yes/no)" { send "yes\r"; exp_continue } "Overwrite existing /etc/sshd_config file? (yes/no)" { send "yes\r"; exp_continue } "Should privilege separation be used? (yes/no)" { send "yes\r" } } set timeout 5 expect { "Should this script create a local user 'sshd' on this machine? (yes/no)" { send "yes\r" } "new local account 'sshd'? (yes/no)" { send "yes\r" } } # [skipped] expect eof { exec cygrunsrv -S sshd } -- ...Bye..Dmitry. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/