Skip to content

Instantly share code, notes, and snippets.

@ryo1kato
Created April 3, 2012 12:37
Show Gist options
  • Save ryo1kato/2291643 to your computer and use it in GitHub Desktop.
Save ryo1kato/2291643 to your computer and use it in GitHub Desktop.
perror - bash implementation
#!/bin/bash
errno_headers="/usr/include/asm-generic/errno-base.h /usr/include/asm-generic/errno.h"
print_usage () {
echo "Usage: ${0##*/} ERRNO"
}
case $1 in
[1-9]|[1-9][0-9]|[1-9][0-9][0-9])
grep --no-filename "\<$1\>" $errno_headers
;;
(-h|--help)
print_usage
exit 1
;;
(*)
print_usage
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment