diff options
| author | mo <mo.khan@gmail.com> | 2019-05-25 19:26:35 -0600 |
|---|---|---|
| committer | mo <mo.khan@gmail.com> | 2019-05-25 19:26:35 -0600 |
| commit | 3b353f1d1f778798fa5a232fd29ef5dd1ce5b8f1 (patch) | |
| tree | 300aaa4c6c98cdfa3be149bf5ed3980ff9119508 /bin | |
| parent | 46ca1dabb41b6e1500f379380fb674b292d7230c (diff) | |
add a test for the hostname parameter
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/problem-7.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/problem-7.sh b/bin/problem-7.sh index 1005ac3..4e53180 100755 --- a/bin/problem-7.sh +++ b/bin/problem-7.sh @@ -1,5 +1,10 @@ #!/bin/sh +if [ $# -eq 0 ]; then + echo "error: a hostname is required" >&2 + exit 1 +fi + destination="$1" host=$(host "$1" | grep 'has address') ip=$(echo "$host" | cut -d' ' -f4) |
