3 # Run GRUB script in a Qemu instance
4 # Copyright (C) 2010 Free Software Foundation, Inc.
6 # GRUB is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # GRUB is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 # Translating a string argument
22 cmd='tr 12345 abcde a1b2c3d4e5'
23 v=`echo "$cmd" | @builddir@/grub-shell`
24 if test "$v" != aabbccddee; then echo "error: $cmd [$v]" >&2; exit 1; fi
27 v=`echo "$cmd" | @builddir@/grub-shell`
28 if test "$v" != ABCDABCD; then echo "error: $cmd [$v]" >&2; exit 1; fi
31 v=`echo "$cmd" | @builddir@/grub-shell`
32 if test "$v" != abcdabcd; then echo "error: $cmd [$v]" >&2; exit 1; fi
35 # Translating a variable value
37 cmd='foo=12345678; tr -s foo 1234 abcd; echo $foo'
38 v=`echo "$cmd" | @builddir@/grub-shell`
39 if test "$v" != abcd5678; then echo "error: $cmd [$v]" >&2; exit 1; fi
41 cmd='foo=abcdEFGH; tr -U -s foo; echo $foo'
42 v=`echo "$cmd" | @builddir@/grub-shell`
43 if test "$v" != ABCDEFGH; then echo "error: $cmd [$v]" >&2; exit 1; fi
45 cmd='foo=abcdEFGH; tr -D -s foo; echo $foo'
46 v=`echo "$cmd" | @builddir@/grub-shell`
47 if test "$v" != abcdefgh; then echo "error: $cmd [$v]" >&2; exit 1; fi
50 # Setting a variable from string argument
52 cmd='foo=12345678; tr -s foo 1234 abcd a1b2c3d4e5; echo $foo'
53 v=`echo "$cmd" | @builddir@/grub-shell`
54 if test "$v" != aabbccdde5; then echo "error: $cmd [$v]" >&2; exit 1; fi
56 cmd='foo=abcdEFGH; tr -U -s foo xyz; echo $foo'
57 v=`echo "$cmd" | @builddir@/grub-shell`
58 if test "$v" != XYZ; then echo "error: $cmd [$v]" >&2; exit 1; fi
60 cmd='foo=abcdEFGH; tr -D -s foo XYZ; echo $foo'
61 v=`echo "$cmd" | @builddir@/grub-shell`
62 if test "$v" != xyz; then echo "error: $cmd [$v]" >&2; exit 1; fi