Funny as I have another script with something like this and works. Don't have quotes.
foreach f ($fnames)
set fdrwtag = `echo $f | awk '/drw/'`
set fsmptag = `echo $f | awk '/smp/'`
set rgdttag = `echo $f | awk '/rgdt/'`
if ($fdrwtag != "") set fdrw = 1 # Darwin tag detected.
if ($fsmptag != "") set fsmp = 1 # Simplex tag detected.
if ($rgdttag != "") set rgdt = 1 # Travel time error tag detected.
...
---------- Post updated at 08:36 PM ---------- Previous update was at 08:35 PM ----------
Yes I might have filenames with - such as n06-z30.ry
---------- Post updated at 08:39 PM ---------- Previous update was at 08:36 PM ----------
As you say it works if I include quotes ("$error" != "")
PS: While metaword "continue" in "a switch within a while" gets you out more cleanly, as unlike "break", it is not a switch metaword.
Usually, one moves all arguments except any final list into exported variables named like the corresponding argument, and then checks for less than minimum or illegal combinations of arguments. This is order-independent, easier to read/maintain and ensures validity before main processing.