i think i need functions ?

Hi, im making a little script but need some help

Code i have so far is

read -p 'Bot Nickname:' ecnick
read -p 'Bot Username:' ecusername
read -p 'Bot Realname:' ecrealname
read -p 'Your Email:' ecemail
echo ''
echo Your bots nickname is set to $ecnick
echo Your bots username is set to $ecusername
echo Your bots realname is set to $ecrealname
Your email is set to $ecemail

Ok what i need to to do is after its displayed the results make it ask if these setting are correct: Y/N

If Y for yes is typed then it will do echo 'All settings are not ready'
but if N for no is typed it will go through the settings again like loop till Y is typed.

Thanks
Gemster

You could do something like:

while true
do
  read -p 'Bot Nickname:' ecnick
  read -p 'Bot Username:' ecusername
  read -p 'Bot Realname:' ecrealname
  read -p 'Your Email:' ecemail
  echo ''
  echo Your bots nickname is set to $ecnick
  echo Your bots username is set to $ecusername
  echo Your bots realname is set to $ecrealname
  read -p 'Are the settings correct? ' yesno

  case $yesno in
    y|Y|Yes|yes)
      echo "All settings are ready"
      break ;;
    q|Q )
      exit ;;
  esac
done

Thanks Franklin52,

All works perfect :smiley:

Thanks again
Gemster