pr-asc.sh

来自「Shall高级编程」· Shell 代码 · 共 37 行

SH
37
字号
#!/bin/bash# pr-ascii.sh: Prints a table of ASCII characters.START=33   # Range of printable ASCII characters (decimal).END=125echo " Decimal   Hex     Character"   # Header.echo " -------   ---     ---------"for ((i=START; i<=END; i++))do  echo $i | awk '{printf("  %3d       %2x         %c\n", $1, $1, $1)}'# The Bash printf builtin will not work in this context:#     printf "%c" "$i"doneexit 0#  Decimal   Hex     Character#  -------   ---     ---------#    33       21         !#    34       22         "#    35       23         ##    36       24         $##    . . .##   122       7a         z#   123       7b         {#   124       7c         |#   125       7d         }#  Redirect the output of this script to a file#+ or pipe it to "more":  sh pr-asc.sh | more

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?