grub_script_not.in 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. true
  18. echo $?
  19. ! true
  20. echo $?
  21. false
  22. echo $?
  23. ! false
  24. echo $?
  25. #
  26. # Negated forms (copied from grub_script_if.in)
  27. #
  28. #basic if, execute
  29. if ! true; then echo yes; fi
  30. #basic if, no execution
  31. if ! false; then echo no; fi
  32. #if else, execute if path
  33. if ! true; then echo yes; else echo no; fi
  34. #if else, execute else path
  35. if ! false; then echo no; else echo yes; fi
  36. #if elif, execute elif
  37. if ! false; then echo no; elif ! true; then echo yes; fi
  38. #if elif else, execute else
  39. if ! false; then echo no; elif ! false; then echo no; else echo yes; fi
  40. #if elif(1) elif(2), execute elif(2)
  41. if false; then echo no; elif ! false; then echo no; elif ! true; then echo yes; fi
  42. #if elif(1) elif(2) else, execute else
  43. if false; then echo no; elif false; then echo no; elif ! false; then echo no; else echo yes; fi
  44. #if {if elif else}, execute elif
  45. if true; then if false; then echo no; elif ! true; then echo yes; else echo no; fi; fi
  46. #if {if elif} else, execute elif. ofcourse no dangling-else problem due to "fi"
  47. if true; then if ! false; then echo no; elif true; then echo yes; fi; else echo no; fi