All pastes #203828 Raw Edit

Unnamed

public text v1 · immutable
#203828 ·published 2006-10-15 13:07 UTC
rendered paste body
#!/bin/bash

# declare Variables
CREATOR="Simon Nickau"
YN="Yes No"
UND=0

echo
echo Hello to $CREATOR"'"s new server setup script!
echo
echo Please enter the username for the new server!

function username {
  echo username:
  read UN
}
while [ $UND -ne 1 ]; do
  username
  echo is $UN correct?
  select opt in $YN; do
    if [ "$opt" = "Yes" ]; then
      echo done
      let UND=1
    elif [ "$opt" = "No" ]; then
      echo Please re-enter:
      let UND=0
    else
      echo Bad option, Please retry.
    fi
  done
done




[simon@localhost ~]$ ./newserver.sh

Hello to Simon Nickau's new server setup script!

Please enter the username for the new server!
username:
test
is test correct?
1) Yes
2) No
#? 2
Please re-enter:
#? 1
done
#? 3
Bad option, Please retry.
#?