Is there a command-line tool that will take a symbolic errno such as EINVAL
and print the corresponding string, Invalid argument
?
I would like to avoid having to find that EINVAL is value 22 on my system and then using$ perror 22
.
Ideally I could write something like
$ errorcommand EINVAL
Invalid argument
$
On my corporate box /usr/include
wasn't available. So I put this portable simple solution (if you have Python) into my init files. You can torture it into a one-liner if you wish:
function strerror () {
python -c "import os, errno; print(os.strerror(errno.$1))"
}
At least for Ubuntu (12.04 and later, to my certain knowledge), there's an errno
utility you can easily install via apt-get install errno
.
$ errno 98
EADDRINUSE 98 Address already in use
$ errno EINVAL
EINVAL 22 Invalid argument
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With