aboutsummaryrefslogtreecommitdiffstats
path: root/gotrc-examples/allow-uppercase
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-09-30 08:28:24 +0200
committerMattias Andrée <maandree@operamail.com>2013-09-30 08:28:24 +0200
commit3e6605c1da199a48c9e6214cc4680b79d21aac87 (patch)
tree19dc6db59facf330d1c3a59f892bca7d8beddd73 /gotrc-examples/allow-uppercase
parentupdate makefile (diff)
downloadgates-of-tartaros-3e6605c1da199a48c9e6214cc4680b79d21aac87.tar.gz
gates-of-tartaros-3e6605c1da199a48c9e6214cc4680b79d21aac87.tar.bz2
gates-of-tartaros-3e6605c1da199a48c9e6214cc4680b79d21aac87.tar.xz
preserve ssh flags' casing when converting username to lower case
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--gotrc-examples/allow-uppercase13
1 files changed, 9 insertions, 4 deletions
diff --git a/gotrc-examples/allow-uppercase b/gotrc-examples/allow-uppercase
index 17a86ce..a54c5f6 100644
--- a/gotrc-examples/allow-uppercase
+++ b/gotrc-examples/allow-uppercase
@@ -1,8 +1,6 @@
# -*- shell-script -*-
-# The module allows you to use upper case letters when login in, however, arguments
-# passed to external programs, like ssh, defined by the user in the login line
-# will be converted to lower case.
+# The module allows you to use upper case letters when login in.
read_function_allow_uppercase=$read_function
@@ -11,7 +9,14 @@ read_function=_read_allow_uppercase
function _read_allow_uppercase
{
$read_function_allow_uppercase
- lower="$(sed -e 'y/QWERTYUIOPASDFGHJKLZXCVBNM/qwertyuiopasdfghjklzxcvbnm' <<< "${user}")"
+ lower=""
+ for word in $user; do
+ if [ ! "${word::1}" = "-" ]; then # this check is done so ssh arguments are not made into lower case
+ word="$(sed -e 'y/QWERTYUIOPASDFGHJKLZXCVBNM/qwertyuiopasdfghjklzxcvbnm/' <<< "${word}")"
+ fi
+ lower="${lower} ${word}"
+ done
+ lower="${lower:1}"
if [ ! "${lower}" = "${user}" ]; then
#stty olcuc ## Uncomment this if you want to go old-school Unix, too bad
## it will break colours and only uppercases ASCII letters.