summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-12 12:20:21 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-12 12:20:21 +0200
commit620dcf263fa83949fe73eb3d46dabed7aa12c393 (patch)
tree77023ec5405c052a80e31c3bac57bfb174af5328
parent14479d66c893f72a6e8313cdca1b3269b2418bc3 (diff)
downloadalpine-conf-620dcf263fa83949fe73eb3d46dabed7aa12c393.zip
setup-hostname: send erro messages to stderr
-rw-r--r--setup-hostname.in8
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
}