Revision 15d336cf tools/bash/setuplib.sh
| tools/bash/setuplib.sh | ||
|---|---|---|
| 123 | 123 | 
    function readUserInput {
   | 
| 124 | 124 | 
    local input=""  | 
| 125 | 125 | 
    # read user input  | 
| 126 | 
      while [ -z $input ] || ( [ -n "$1" ] && [[ ! $input =~ ^[$1]$ ]] ); do
   | 
|
| 126 | 
      while [ -z "$input" ] || ( [ -n "$1" ] && [[ ! $input =~ ^[$1]$ ]] ); do
   | 
|
| 127 | 127 | 
    read -p "your selection: " -n 1 -e input  | 
| 128 | 
        if [ -z $input ] || ( [ -n "$1" ] && [[ ! $input =~ ^[$1]$ ]] ); then
   | 
|
| 128 | 
        if [ -z "$input" ] || ( [ -n "$1" ] && [[ ! $input =~ ^[$1]$ ]] ); then
   | 
|
| 129 | 129 | 
    printWarning "[$input] is no valid action\n"  | 
| 130 | 130 | 
    fi  | 
| 131 | 131 | 
    done  | 
Also available in: Unified diff