1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Adapted from gold/echo-e.sh, which was adapted from spec/builtin-io.test.sh.
|
4 |
|
5 | echo $'foo\tbar\n'
|
6 |
|
7 | echo $'foo\tbar\n\
|
8 | baz'
|
9 |
|
10 | echo $'\\'
|
11 | echo $'abc\ndef\n'
|
12 | echo $'\a\b\d\e\f'
|
13 | echo $'\n\r\t\v'
|
14 | # Doesn't pass because Python can have NUL embedded in strings!
|
15 | #echo $'ab\0cd' | od -A n -c | sed 's/ \+/ /g'
|
16 | echo $'abcd\x65f'
|
17 | echo $'abcd\044e'
|
18 | echo $'abcd\u0065f'
|
19 | echo $'abcd\U00000065f'
|
20 |
|
21 | # NOTE: $'\377' is echo -e '\0377', with leading 0
|
22 | echo $'\3777' | od -A n -t x1 | sed 's/ \+/ /g'
|
23 | echo $'\4010' | od -A n -t x1 | sed 's/ \+/ /g'
|
24 | echo $'\777' | od -A n -t x1 | sed 's/ \+/ /g'
|
25 |
|
26 | # This wraps to \0, so it's not used.
|
27 | #echo $'\4000' | od -A n -t x1 | sed 's/ \+/ /g'
|
28 |
|
29 | echo $'abcd\x6' | od -A n -c | sed 's/ \+/ /g'
|
30 | echo $'\x' $'\xg' | od -A n -c | sed 's/ \+/ /g'
|
31 | echo $'abcd\04' | od -A n -c | sed 's/ \+/ /g'
|
32 | echo $'abcd\u006' | od -A n -c | sed 's/ \+/ /g'
|
33 | echo $'\u6' | od -A n -c | sed 's/ \+/ /g'
|
34 | #echo $'\0' '\1' '\8' | od -A n -c | sed 's/ \+/ /g'
|
35 |
|
36 | echo $'\1 \11 \11 \111' | od -A n -c | sed 's/ \+/ /g'
|
37 |
|
38 | echo $'foo
|
39 | bar'
|
40 |
|
41 | echo $'foo\
|
42 | bar'
|