Having Issues in Csh

I am having the worst time trying to figure out this simple little script and I'm about to go nuts.

I have to use csh to create this script for a class and the problem I run into is checking my number range, just validating that the number is between 1 and 9 inclusive. I tried:

if [1 <= $number && $number <= 9]
   ...
else
   ...
endif

But it gives me a file redirection error message and I understand why, my brain is just quitting on me in trying to figure out how to fix it. Any help would be greatly appreciated! :slight_smile:

Can you post the entire script? Also when you run it, it should post an error message, paste the exact error as well.

I will remember that for next time, I actually just figured it out >.<

Figured out that brackets and parentheses are not interchangeable and that I had my $number on the wrong side of the inequality, hence the redirecting error message.

Thanks though, and I will definitely remember to post the entire thing plus error messages next time :slight_smile:

if ( $number >= 1 && $number <= 9 ) then

Yep, I know ygemici, that's what I posted above your post that I had figured it out.