grub_script_break.in 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #! @builddir@/grub-shell-tester
  2. #
  3. # Copyright (C) 2010 Free Software Foundation, Inc.
  4. #
  5. # GRUB is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # GRUB is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. # break without any arguments
  18. for i in 1 2 3 4 5 6 7 8 9 10
  19. do
  20. echo $i
  21. if test "$i" = 5
  22. then
  23. break
  24. fi
  25. done
  26. # break with one
  27. for i in 1 2 3 4 5 6 7 8 9 10
  28. do
  29. echo $i
  30. if test "$i" = 5
  31. then
  32. break 1
  33. fi
  34. done
  35. # break with loop count
  36. for i in 1 2 3 4 5
  37. do
  38. for j in a b c d e f
  39. do
  40. echo "$i $j"
  41. if test "$i" = 3
  42. then
  43. if test "$j" = d
  44. then
  45. break 2
  46. fi
  47. fi
  48. done
  49. done
  50. # break into middle loop
  51. for i in 1 2 3 4 5
  52. do
  53. for j in a b c d e f
  54. do
  55. echo "$i $j"
  56. if test "$i" = 3
  57. then
  58. if test "$j" = d
  59. then
  60. break 1
  61. fi
  62. fi
  63. done
  64. done
  65. # while and until loops
  66. a=
  67. while test "$a" != "aaaaaaa"
  68. do
  69. a="a$a"
  70. for i in 1 2 3 4
  71. do
  72. b=
  73. until test "$b" = "bbbbb"
  74. do
  75. b="b$b"
  76. echo "$a $i $b"
  77. if test "$i" = 3; then echo "break 2"; break 2; fi
  78. done
  79. done
  80. done