I am testing following code that intends to get input from user and after checking some conditions store it to a new variable. However, this code is not giving me any output or error upon running in the shell terminal. I have given execution permission to the file by sudo chmod +x test.sh
.
#!/bin/bash counter="0" iso_val="100" while [ "$counter" == "3" ] do echo -n "Enter ISO [ 100-800 ]: "; read iso if (( "$iso" < "100" )) || (( "$iso" > "800" )); then echo "Error!" elif [ "$iso" == "" ]; then echo "Error!" else iso_val=$iso break fi counter=$[$counter + 1] done
counter
to 0 and then started a while loop which only runs when it's 3. O.o Obviously the loop will never run.counter="1" iso_val="100" while [ "$counter" = "3" ]