aboutsummaryrefslogtreecommitdiffstats
path: root/gotrc-examples
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-12-02 10:01:50 +0100
committerMattias Andrée <maandree@operamail.com>2013-12-02 10:01:50 +0100
commit5c70c985ad528a14e630d9486f81686c33cbf585 (patch)
tree5090a8bde518389b86fa00d68dff19e13ffecafc /gotrc-examples
parentin hide-username: go the next line when the user presses enter (diff)
downloadgates-of-tartaros-5c70c985ad528a14e630d9486f81686c33cbf585.tar.gz
gates-of-tartaros-5c70c985ad528a14e630d9486f81686c33cbf585.tar.bz2
gates-of-tartaros-5c70c985ad528a14e630d9486f81686c33cbf585.tar.xz
remove dependency of bash to hide username
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'gotrc-examples')
-rw-r--r--gotrc-examples/hide-username26
1 files changed, 22 insertions, 4 deletions
diff --git a/gotrc-examples/hide-username b/gotrc-examples/hide-username
index 3c86304..c9d01a0 100644
--- a/gotrc-examples/hide-username
+++ b/gotrc-examples/hide-username
@@ -1,16 +1,34 @@
# -*- shell-script -*-
-# This module requires that got runs under GNU Bash.
-
# This module hides the username when it is types,
# this can be useful so that nopony can se your
# passphrase if you type it in instead of your
# username by mistake when you log in.
-_read ()
+
+read_function_hide_username=$read_function
+read_function=_read_hide_username
+
+_read_hide_username ()
{
- read -s user
+ local _read_tty_settings
+ _read_tty_settings = "$(stty --save)"
+ stty -echo
+
+ $read_function_hide_username
+
+ stty "${_read_tty_settings}"
echo
}
+
+# If you use GNU Bash for gates-of-tartaros,
+# you can use this instead:
+
+# _read ()
+# {
+# read -s user
+# echo
+# }
+