Boolean expressions for If's

  1. The problem statement, all variables and given/known data:
    Im experimenting with if expressions for an assignment. What i want to do is check if an input of
read x y z

will be checked against x for 1-999 for y for [ASDM] and for z for 1-999. Am i doing this right? or perhaps you could tell me whats the proper expression for such an example.

  1. Relevant commands, code, scripts, algorithms:

P.S. I am using cygwin in windows to do this script.

  1. The attempts at a solution (include all code and scripts):
if [[ $x -ge 1 -o -le 999 ]] && [[  "$y" == [ASMD] ]] && [[ $z -ge 1 -o -le 999
]]; then
  1. Insearch: (University of Technology Sydney), Sydney NSW, Australia, James Hu (web systems), Information Technology Local - UTS:INSEARCH

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

EDIT:

if [[ $x -eq [1-999] ]] && [[  "$y" == [ASMD] ]] && [[ $z -eq [1-999] ]]; then

ive also tried this but it doesnt work either.

EDIT2: after further research i end up with

if [ $x -ge 1 -a $x -le 999 ] && [ $z -eq 1 -a $z -le 999 ]; then

with a case to filter out "y" for the right values. Yet my code still isnt working. Any ideas?

---------- Post updated at 09:28 PM ---------- Previous update was at 08:31 PM ----------

Never mind i figured it out what i did wrong that is. I needed to restate the variable im comparing to after the -o and the -o should be a -a. You may close this thread now :P!