How can I get the character code using only bash, without xdd?

No use perl, python, and similar.


Use printf, a bash builtin:

If you want the ASCII code of a character in hex:

function ord {
  printf %x "'$1"

ord A # 41
ord 0 # 30

The use of the single leading quote is explained here:

If the leading character is a single-quote or double-quote, the value shall be the numeric value in the underlying codeset of the character following the single-quote or double-quote.

Need Your Help

Execute a PyDev project in the Python Interactive Console?

python console pydev interactive

I'm a begginer in Python and PyDev. I recently made the "helloworld" program in PyDev. My question is: how do I execute it or open it in the interactive Python mode (in Linux terminal) I tried many