intl/mangle-unprintable
raw| 1 | #!/bin/sh |
| 2 | LC_ALL=C |
| 3 | export LC_ALL |
| 4 | a="sed" |
| 5 | i=1 |
| 6 | while [ $i -lt 256 ]; do |
| 7 | if [ $i -lt 32 -o $i -ge 127 ]; then |
| 8 | oct="`printf %03o $i`" |
| 9 | char="`printf \\\\$oct`" |
| 10 | a="$a -e 's/$char/\\\\\\\\$oct/g'" |
| 11 | fi |
| 12 | i=`expr $i + 1` |
| 13 | done |
| 14 | # bash and dash differ here: bash creates double backslashes, dash single |
| 15 | echo "$a"|sed 's/\\\\\\\\/\\\\/g' |