Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat 
-Werror=format-security -Wall
uname output: Linux amnesia 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 
6.1.90-1 (2024-05-03) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.2
Patch Level: 15
Release Status: release

Description:
# If the input string of a READ matches a variable in the script, REPLY is
# set to the value that variable, not to the string.


Repeat-By:
Execute script below & enter 52, z, ab
#####
ab=5
z=25
declare -i int

echo "ab : ${ab}    int : ${int}    z : $z"
echo "Input  ab  displays 5, exits the loop"
echo "        z  displays 25"

# Read input, exit if between 1..9.
until [[ "${val}" -ge 1 ]] && [[ ${val} -le 9 ]]; do
  read -p "enter letters/numbers (1..9 to quit) : "  val
  int=${val}                    # assign to integer
  echo "val : ${val}    int : ${int}"
done

Best regards

Reply via email to