I want to check if a zip code is valid, using a variable that stores the zipcode. I am not sure how I would do this in a script. I know that simply checking for the numerical range of the number will not work, because '1' would be '00001' in zip code format. I know when I am in shell, I can use wildcards and ranges to find certain files. How would I do something similar in C shell scripting? This following code is my attempt of checking for correct zip code format.
if ( $zipcode == "[0-9][0-9][0-9][0-9][0-9]" ) then
echo Zip code is in correct format
My specific suggestion is to look in man csh for "==".
My general suggestion is to avoid csh for scripting if at all possible. I often use tcsh for interactive work, but I use the Bourne shell family for scripting. It makes life far easier for me. See Csh Programming Considered Harmful for details.