ieee1275: split up grub_machine_get_bootlocation
[grub.git] / tests / grub_cmd_tr.in
1 #! @BUILD_SHEBANG@ -e
2
3 # Run GRUB script in a Qemu instance
4 # Copyright (C) 2010  Free Software Foundation, Inc.
5 #
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.
10 #
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.
15 #
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/>.
18
19 #
20 # Translating a string argument
21 #
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
25
26 cmd='tr -U abcdABCD'
27 v=`echo "$cmd" | @builddir@/grub-shell`
28 if test "$v" != ABCDABCD; then echo "error: $cmd [$v]" >&2; exit 1; fi
29
30 cmd='tr -D ABCDabcd'
31 v=`echo "$cmd" | @builddir@/grub-shell`
32 if test "$v" != abcdabcd; then echo "error: $cmd [$v]" >&2; exit 1; fi
33
34 #
35 # Translating a variable value
36 #
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
40
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
44
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
48
49 #
50 # Setting a variable from string argument
51 #
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
55
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
59
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