pure-bash-bible icon indicating copy to clipboard operation
pure-bash-bible copied to clipboard

add chr() and ord()

Open neuhaus opened this issue 5 years ago • 0 comments

ord is usually handled by the external "od" command.

chr() {
  [ "$1" -lt 256 ] || return 1
  printf "\\$(printf '%03o' "$1")"
}

ord() {
  LC_CTYPE=C printf '%d' "'$1"
}

Source

neuhaus avatar Sep 19 '19 10:09 neuhaus