aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-06-26 12:45:42 +1200
committerTom Ryder <tom@sanctum.geek.nz>2015-06-26 12:45:42 +1200
commit757b86ada0b2db05a6299dc6579c9b8d60dd852f (patch)
tree00b9018e96969e4f0a05a02c40d3c070db4f27a6 /bin
parentTerminate rm(1) options in edda(1) EXIT trap (diff)
downloaddotfiles-757b86ada0b2db05a6299dc6579c9b8d60dd852f.tar.gz
dotfiles-757b86ada0b2db05a6299dc6579c9b8d60dd852f.zip
Move argument check further up script
Diffstat (limited to 'bin')
-rwxr-xr-xbin/edda12
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/edda b/bin/edda
index bc17993d..2bfe994e 100755
--- a/bin/edda
+++ b/bin/edda
@@ -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"