Commit | Line | Data |
---|---|---|
c2199a45 AM |
1 | #!/bin/sh |
2 | SED=./sed | |
3 | PRINTF=printf | |
4 | ||
5 | # tests that a delimiter okay in ccl, i.e., s/[/]// deletes a / | |
6 | abc=`$PRINTF 'hello/world\n' | $SED 's/[/]/x/;s/\n//'` | |
7 | [ ! X"$abc" = Xhelloxworld ] && { echo "(1) failed: $abc"; } | |
8 | ||
9 | # tests that a \ is not a general escape character in ccl, i.e., s/[\]// | |
10 | # deletes a \ | |
11 | abc=`$PRINTF 'hello\\world\n' | $SED 's/[\]/x/'` | |
12 | [ ! X"$abc" = Xhelloxworld ] && { echo "(2) failed: $abc"; } | |
13 | ||
14 | # tests that a \n is mapped to a newline in ccl, i.e., s/[\n]// | |
15 | # deletes a newline | |
16 | abc=`$PRINTF 'hello\nworld\n' | $SED 'N; s/[\n]/x/'` | |
17 | [ ! X"$abc" = Xhelloxworld ] && { echo "(3) failed: $abc"; } | |
18 | ||
19 | # tests that a \\ does not map to a \ in ccl, i.e., s/[\\n]// | |
20 | # deletes a newline - not a \ or an n | |
21 | abc=`$PRINTF 'hello\n\\world\n' | $SED 'N; s/[\\n]/x/;s/[\]/y/'` | |
22 | [ ! X"$abc" = Xhelloxyworld ] && { echo "(4) failed: $abc"; } | |
23 | ||
24 | abc=`$PRINTF 'helloworld\n' | $SED 's/[[:alpha:]]/x/'` | |
25 | [ ! X"$abc" = Xxelloworld ] && { echo "(5) failed: $abc"; } |