aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--setup-hostname.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/setup-hostname.in b/setup-hostname.in
index c551de7..c699d54 100644
--- a/setup-hostname.in
+++ b/setup-hostname.in
@@ -7,13 +7,14 @@ PREFIX=
usage() {
cat <<__EOF__
-usage: setup-hostname [-h] [-n hostname]
+usage: setup-hostname [-h] [HOSTNAME]
Sets the system hostname.
options:
-h Show this help
- -n Specify the hostname to set
+
+Sets hostname to HOSTNAME or prompt if unspecified.
__EOF__
exit 1
}
@@ -44,7 +45,10 @@ while getopts "hn:" opt; do
n) HOSTNAME="$OPTARG";;
esac
done
-
+shift $(( $OPTIND - 1 ))
+if [ -z "$HOSTNAME" ] && [ $# -eq 1 ]; then
+ HOSTNAME="$1"
+fi
while true; do
if [ -n "$HOSTNAME" ]; then