From 89f8903bc5b942211c95e3a1dfdf1d030be8596d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 30 Sep 2013 23:29:44 +0200 Subject: portability 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 | 8 ++++---- gotrc-examples/commands | 2 +- gotrc-examples/issue-file | 2 +- gotrc-examples/lower-left-ponysay | 9 +++++---- gotrc-examples/no-empty-user | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) (limited to 'gotrc-examples') diff --git a/gotrc-examples/allow-uppercase b/gotrc-examples/allow-uppercase index a54c5f6..aa13d07 100644 --- a/gotrc-examples/allow-uppercase +++ b/gotrc-examples/allow-uppercase @@ -6,17 +6,17 @@ read_function_allow_uppercase=$read_function read_function=_read_allow_uppercase -function _read_allow_uppercase +_read_allow_uppercase () { $read_function_allow_uppercase 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}")" + if [ ! "${word%%-*}" = "" ]; then # This check is done so SSH arguments are not made into lower case + word="$(echo "${word}" | sed -e 'y/QWERTYUIOPASDFGHJKLZXCVBNM/qwertyuiopasdfghjklzxcvbnm/')" fi lower="${lower} ${word}" done - lower="${lower:1}" + lower="${lower# *}" 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. diff --git a/gotrc-examples/commands b/gotrc-examples/commands index 1a98b07..6c382bf 100644 --- a/gotrc-examples/commands +++ b/gotrc-examples/commands @@ -8,7 +8,7 @@ login_function=_login_commands function _login_commands { - if [ "${user::1}" = "+" ]; then + if [ "${user%%+*}" = "" ]; then if [ "${user}" = "+shutdown" ]; then shutdown -h now elif [ "${user}" = "+reboot" ]; then diff --git a/gotrc-examples/issue-file b/gotrc-examples/issue-file index 85cc442..9f973e8 100644 --- a/gotrc-examples/issue-file +++ b/gotrc-examples/issue-file @@ -4,7 +4,7 @@ # only partially implemented, but also extended -function _display +_display () { python3 <