diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-01 22:07:39 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-01 22:07:39 +1200 |
commit | 51d75ea05040c230eb9e11d5d97e56fb3b5b42d7 (patch) | |
tree | 6de8b424e6116f2c1f26701f53ce8a6c67073d13 /bin | |
parent | Have dub(1) include dotfiles (diff) | |
download | dotfiles-51d75ea05040c230eb9e11d5d97e56fb3b5b42d7.tar.gz dotfiles-51d75ea05040c230eb9e11d5d97e56fb3b5b42d7.zip |
Trim ax(1) down a bit
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ax | 23 |
1 files changed, 4 insertions, 19 deletions
@@ -1,14 +1,7 @@ #!/bin/sh +# Evaluate an Awk expression given on the command line with an optional format -# ax(1): Evaluate an Awk expression given on the command line with an optional -# format. - -# Usage function -usage() { - printf 'ax: USAGE: ax [format] expression\n' -} - -# Check number of arguments +# Count arguments case $# in # If one argument, we assume format is %s @@ -19,19 +12,11 @@ case $# in # Any other number of arguments is wrong *) - usage >&2 + printf >&2 'ax: Need an expression\n' exit 2 ;; esac -# Give help if requested -case $1 in - -h|--help|-\?) - usage - exit 0 - ;; -esac - # Form program prog=$(printf ' BEGIN { @@ -39,5 +24,5 @@ prog=$(printf ' } ' "$form" "$expr") -# Run the program +# Run program awk "$prog" |