Debian Codegraph @

pr-asc.sh

raw symbols SCIP
1 #!/bin/bash
2 # pr-ascii.sh: Prints a table of ASCII characters.
3
4 START=33 # Range of printable ASCII characters (decimal).
5 END=127 # Will not work for unprintable characters (> 127).
6
7 echo " Decimal Hex Character" # Header.
8 echo " ------- --- ---------"
9
10 for ((i=START; i<=END; i++))
11 do
12 echo $i | awk '{printf(" %3d %2x %c\n", $1, $1, $1)}'
13 # The Bash printf builtin will not work in this context:
14 # printf "%c" "$i"
15 done
16
17 exit 0
18
19
20 # Decimal Hex Character
21 # ------- --- ---------
22 # 33 21 !
23 # 34 22 "
24 # 35 23 #
25 # 36 24 $
26 #
27 # . . .
28 #
29 # 122 7a z
30 # 123 7b {
31 # 124 7c |
32 # 125 7d }
33
34
35 # Redirect the output of this script to a file
36 #+ or pipe it to "more": sh pr-asc.sh | more