From 72ac0734d1cda5e26b243d6b956dac238b19bd10 Mon Sep 17 00:00:00 2001 From: Dirk Date: Sat, 5 Nov 2016 14:55:30 +0100 Subject: [PATCH] tolower --- testssl.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/testssl.sh b/testssl.sh index f3af95e..4d97e30 100755 --- a/testssl.sh +++ b/testssl.sh @@ -566,9 +566,13 @@ trim_trailing_space() { echo "${1%%*( )}" } -toupper() { - echo -n "$1" | tr 'a-z' 'A-Z' -} +if [[ $(uname) == "Linux" ]] ; then + toupper() { echo -n "${1^^}" ; } + tolower() { echo -n "${1,,}" ; } +else + toupper() { echo -n "$1" | tr 'a-z' 'A-Z'; } + tolower() { echo -n "$1" | tr 'A-Z' 'a-z' ; } +fi is_number() { [[ "$1" =~ ^[1-9][0-9]*$ ]] && \ @@ -1524,7 +1528,7 @@ normalize_ciphercode() { HEXC="$part1$part2$part3" fi #TODO: we should just echo this and avoid the global var HEXC - HEXC=$(echo $HEXC | tr 'A-Z' 'a-z' | sed 's/0x/x/') #tolower + strip leading 0 + HEXC=$(tolower "$HEXC"| sed 's/0x/x/') # strip leading 0 return 0 } @@ -9066,4 +9070,4 @@ fi exit $? -# $Id: testssl.sh,v 1.561 2016/10/29 13:37:29 dirkw Exp $ +# $Id: testssl.sh,v 1.562 2016/11/05 13:55:29 dirkw Exp $