From d3ac35d2f29ddc4199e9487b80669dd582315ef3 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Wed, 5 Jan 2011 06:03:31 -0800 Subject: [PATCH] abort --- bin/n | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/n b/bin/n index 662025c..c3d362f 100755 --- a/bin/n +++ b/bin/n @@ -14,6 +14,10 @@ which wget > /dev/null && GET="wget -q -O-" # curl support which curl > /dev/null && GET="curl -# -L" +# Ensure we have curl or wget + +test -z "$GET" && abort "curl or wget required" + # # Log the given # @@ -22,6 +26,14 @@ log() { echo "... $@" } +# +# Exit with the given +# + +abort() { + echo "Error: $@" && exit 1 +} + # # Output usage information. #