diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-26 12:45:42 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-26 12:45:42 +1200 |
commit | 757b86ada0b2db05a6299dc6579c9b8d60dd852f (patch) | |
tree | 00b9018e96969e4f0a05a02c40d3c070db4f27a6 /bin/edda | |
parent | Terminate rm(1) options in edda(1) EXIT trap (diff) | |
download | dotfiles-757b86ada0b2db05a6299dc6579c9b8d60dd852f.tar.gz dotfiles-757b86ada0b2db05a6299dc6579c9b8d60dd852f.zip |
Move argument check further up script
Diffstat (limited to 'bin/edda')
-rwxr-xr-x | bin/edda | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -21,6 +21,12 @@ usage() { printf 'USAGE: %s [OPTS] [--] FILE1 [FILE2...]\n' "$self" } +# Need at least one file +if ! (($#)) ; then + usage >&2 + exit 1 +fi + # Parse options out, give help if necessary declare -a opts for arg ; do @@ -48,12 +54,6 @@ cleanup() { trap cleanup EXIT cat > "$stdin" -# Need at least one file -if ! (($#)) ; then - usage >&2 - exit 1 -fi - # Run ed(1) over each file with the options and stdin given for file ; do ed "${opts[@]}" -- "$file" < "$stdin" |