diff --git a/http b/http index 599018d..7e58307 100755 --- a/http +++ b/http @@ -11,6 +11,7 @@ IFS=$'\n' if [ -z $1 ]; then echo 'Type a number like "http 200" to see what protocol it is,' echo 'or type "http -l" for the master list' + exit 1 fi statuses=( @@ -85,6 +86,10 @@ YELLOW='\033[0;33m' NC='\033[0m' # No Color function colors () { + if [ $# -eq 0 ]; then + echo "No arguments supplied" + exit 1 + fi if [[ "$i" =~ ^1 ]]; then printf "${CYAN}${i}${NC}\n" elif [[ "$i" =~ ^2 ]]; then @@ -103,7 +108,7 @@ function colors () { if [ $1 ]; then for i in ${statuses[@]}; do - if [[ "$i" =~ "${1}" ]]; then + if [[ "$i" =~ ^"${1}" ]]; then colors $i fi done @@ -117,3 +122,5 @@ if [[ $1 =~ "-l" ]]; then colors i done fi + +exit 0 diff --git a/readme.md b/readme.md index 2a741bf..e5f574f 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ #http -A command line tool for looking up http protocols +A command line tool for looking up http statuses ##Installation `$ curl -o /usr/local/bin/http https://raw.githubusercontent.com/gazayas/http/master/http`