diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-09-08 09:35:30 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-09-08 09:35:30 -0700 |
commit | 84c8616cb9b8f3847f6a8581e49e92d02b335beb (patch) | |
tree | 6e1fae9443147c177fc5a933e48fe51f6691328a | |
parent | 54975c05b4f2f904426fdbf8895e7e4f0c7e7749 (diff) | |
download | vyatta-cfg-quagga-84c8616cb9b8f3847f6a8581e49e92d02b335beb.tar.gz vyatta-cfg-quagga-84c8616cb9b8f3847f6a8581e49e92d02b335beb.zip |
Fix quoting issues with conversion to lower case
Add common shell function to convert to lower case.
Part of Bug 6132
-rwxr-xr-x | scripts/install-system | 10 | ||||
-rwxr-xr-x | scripts/install/install-functions | 10 |
2 files changed, 14 insertions, 6 deletions
diff --git a/scripts/install-system b/scripts/install-system index 64e2915f..4281fc8d 100755 --- a/scripts/install-system +++ b/scripts/install-system @@ -101,18 +101,22 @@ turnoffswap () { fi } +tolower () { + echo "$*" | tr '[:upper:]' '[:lower:]' +} + # Validates a user response. Returns the response if valid. # Returns the default is the user just hits enter. # Returns nothing if not valid. Default parameter is $1. # Options are in $2. If options are defined return must be a member # of the enum. get_response () { - ldefault=$(echo "$1" | tr [:upper:] [:lower:]) - loptions=$(echo "$2" | tr [:upper:] [:lower:]) + local ldefault=$(tolower "$1") + local loptions=$(tolower "$2") # get the response from the user read myresponse - myresponse=$(echo "$myresponse" | tr [:upper:] [:lower:]) + myresponse=$(tolower "$myresponse") # Check to see if the user accepts the default if [ -z "$myresponse" ]; then diff --git a/scripts/install/install-functions b/scripts/install/install-functions index ff4d6f48..ffaea22d 100755 --- a/scripts/install/install-functions +++ b/scripts/install/install-functions @@ -83,18 +83,22 @@ becho () echo -e "$*" } +tolower () { + echo "$*" | tr '[:upper:]' '[:lower:]' +} + # Validates a user response. Returns the response if valid. # Returns the default is the user just hits enter. # Returns nothing if not valid. Default parameter is $1. # Options are in $2. If options are defined return must be a member # of the enum. get_response () { - ldefault=$(echo "$1" | tr [:upper:] [:lower:]) - loptions=$(echo "$2" | tr [:upper:] [:lower:]) + local ldefault=$(tolower "$1") + local loptions=$(tolower "$2") # get the response from the user read myresponse - myresponse=$(echo "$myresponse" | tr [:upper:] [:lower:]) + myresponse=$(tolower "$myresponse") # Check to see if the user accepts the default if [ -z "$myresponse" ]; then |