OILS / test / gold / dollar-sq.sh View on Github | oilshell.org

42 lines, 21 significant
1#!/usr/bin/env bash
2#
3# Adapted from gold/echo-e.sh, which was adapted from spec/builtin-io.test.sh.
4
5echo $'foo\tbar\n'
6
7echo $'foo\tbar\n\
8baz'
9
10echo $'\\'
11echo $'abc\ndef\n'
12echo $'\a\b\d\e\f'
13echo $'\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'
16echo $'abcd\x65f'
17echo $'abcd\044e'
18echo $'abcd\u0065f'
19echo $'abcd\U00000065f'
20
21# NOTE: $'\377' is echo -e '\0377', with leading 0
22echo $'\3777' | od -A n -t x1 | sed 's/ \+/ /g'
23echo $'\4010' | od -A n -t x1 | sed 's/ \+/ /g'
24echo $'\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
29echo $'abcd\x6' | od -A n -c | sed 's/ \+/ /g'
30echo $'\x' $'\xg' | od -A n -c | sed 's/ \+/ /g'
31echo $'abcd\04' | od -A n -c | sed 's/ \+/ /g'
32echo $'abcd\u006' | od -A n -c | sed 's/ \+/ /g'
33echo $'\u6' | od -A n -c | sed 's/ \+/ /g'
34#echo $'\0' '\1' '\8' | od -A n -c | sed 's/ \+/ /g'
35
36echo $'\1 \11 \11 \111' | od -A n -c | sed 's/ \+/ /g'
37
38echo $'foo
39bar'
40
41echo $'foo\
42bar'