LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Newbie bash help with loop (https://www.linuxquestions.org/questions/linux-newbie-8/newbie-bash-help-with-loop-707044/)

manwithaplan 02-24-2009 02:40 AM

Newbie bash help with loop
 
I am uncertain if this will work... I'm new with scripting and have received excellent help here. This is an excerpt of the end of my script.

This part is used to copy my secondary script to the chroot and continue with my setup.
I've pastebin the code if someone would be kind enough to critique

Code:

#THE LOOP DOESN'T SEEM RIGHT BECAUSE THE LOOP WOULD BREAK AFTER THE CHROOT COMMAND IS USED...?
#CHROOT AND CONTINUE  .....   
while [ $CHRT -ne 0 ]
 do
echo "Chrooting into Environment"
echo "Please choose which Arch you installed"
echo
echo "1- You installed Core2Duo"
echo "2- You installed i686"
echo
echo
read -p "Enter selection (1-2) and press Enter" CHRT 
 case $CHRT in
  1)
      cp $HOME/FAI/script_x64 /mnt/funtoo      #I'D LIKE TO ECHO USERS PATH TO PREVENT HAVING TO USE AN ABSOLUTE PATH TO COPY TO PREVENT ERROR
      chroot /mnt/funtoo script_x64            #IS THIS THE RIGHT COMMAND TO EXECUTE THE CHROOTED SCRIPT...?
    break;;
 
  2)
      cp $HOME/FAI/script_x86 /mnt/funtoo
      chroot /mnt/funtoo script_x86
    break;;

  *)
      echo
      echo "Not a valid selection, please try again!"
      echo ;;
  esac
done
#THIS WILL CONTINUE ONTO THE NEXT SCRIPT THAT I HAVE COPIED TO THE CHROOTED PARTITION



All times are GMT -5. The time now is 11:05 AM.