diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-12 12:20:21 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-12 12:20:21 +0200 |
commit | 620dcf263fa83949fe73eb3d46dabed7aa12c393 (patch) | |
tree | 77023ec5405c052a80e31c3bac57bfb174af5328 /setup-hostname.in | |
parent | 14479d66c893f72a6e8313cdca1b3269b2418bc3 (diff) | |
download | alpine-conf-620dcf263fa83949fe73eb3d46dabed7aa12c393.zip |
setup-hostname: send erro messages to stderr
Diffstat (limited to 'setup-hostname.in')
-rw-r--r-- | setup-hostname.in | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/setup-hostname.in b/setup-hostname.in index a655a58..c4f876a 100644 --- a/setup-hostname.in +++ b/setup-hostname.in @@ -24,18 +24,18 @@ usage() { valid_hostname() { # check length if [ $(echo "$1" | wc -c) -gt 255 ]; then - echo "Hostname '$1' is too long." + echo "Hostname '$1' is too long." >&2 return 1 fi # check that it only contains valid chars if ! [ -z "$(echo $1 | sed 's/[0-9a-z.-]//g')" ]; then - echo "Hostname must only contain letters (a-z), digits (0-9), '.' or '-'" + echo "Hostname must only contain letters (a-z), digits (0-9), '.' or '-'" >&2 return 1 fi # must not start with - or . case "$1" in - -*) echo "Hostname must not start with a '-'"; return 1;; - .*) echo "Hostname must not start with a '.'"; return 1;; + -*) echo "Hostname must not start with a '-'" >&2; return 1;; + .*) echo "Hostname must not start with a '.'" >&2; return 1;; esac return 0 } |