grub_script_shift.in 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #! @builddir@/grub-shell-tester
  2. # Run GRUB script in a Qemu instance
  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. function f1 {
  18. echo f1 '$@' $@
  19. echo f1 '$*' $*
  20. echo f1 $# $1 $2 $3
  21. shift
  22. echo f1 '$@' $@
  23. echo f1 '$*' $*
  24. echo f1 $# $1 $2 $3
  25. }
  26. f1
  27. f1 a
  28. f1 a b
  29. f1 a b c
  30. f1 a b c d
  31. f1 a b c d e
  32. function f2 {
  33. echo f1 '$@' $@
  34. echo f1 '$*' $*
  35. echo f2 $# $1 $2 $3
  36. shift 1
  37. echo f1 '$@' $@
  38. echo f1 '$*' $*
  39. echo f2 $# $1 $2 $3
  40. }
  41. f2
  42. f2 a
  43. f2 a b
  44. f2 a b c
  45. f2 a b c d
  46. f2 a b c d e
  47. function f3 {
  48. echo f1 '$@' $@
  49. echo f1 '$*' $*
  50. echo f3 $# $1 $2 $3
  51. shift 3
  52. echo f1 '$@' $@
  53. echo f1 '$*' $*
  54. echo f3 $# $1 $2 $3
  55. }
  56. f3
  57. f3 a
  58. f3 a b
  59. f3 a b c
  60. f3 a b c d
  61. f3 a b c d e
  62. function f4 {
  63. echo f1 '$@' $@
  64. echo f1 '$*' $*
  65. echo f4 $# $1 $2 $3
  66. shift 100
  67. echo f1 '$@' $@
  68. echo f1 '$*' $*
  69. echo f4 $# $1 $2 $3
  70. }
  71. f4
  72. f4 a
  73. f4 a b
  74. f4 a b c
  75. f4 a b c d
  76. f4 a b c d e