From 3e6605c1da199a48c9e6214cc4680b79d21aac87 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 30 Sep 2013 08:28:24 +0200 Subject: preserve ssh flags' casing when converting username to lower case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- gotrc-examples/allow-uppercase | 13 +++++++++---- 1 file 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. -- cgit v1.2.3-70-g09d2