Although I'm not too familiar with this shell, I would add in some echo statements to see what the value is exactly for $parameter. Maybe before the if statement, you could add something like:
echo "parameter = x${parameter}x"
What you want to see then is:
parameter = xstringx
This will rule out any spaces or hidden characters that might be in there.
ok, I discovered the problem, but it's very odd.
At the beginning of the script I defined parameter.
I echoed it right after the definition and it was okay.
I echoed it right before the if like you said, but it showed me that inside parameter, instead of string, there was 0!
It's as if parameter was changed throughout the script, but I didn't touch it until I got to the if part!
The fact that it was 0 is suspicious. Normally 0 indicates that a command was run successfully. Without seeing your code it's hard to tell but it leads me to wonder if somehow $parameter was reassigned by the result of a previous execution. It's just my guess though.
ok, I tried a little test, and I discovered that it changes parameter during the condition of the if. very strange.
Here's the code:
set parameter = ${3} #${3} is the string
echo "$parameter" #works fine, returns string.
if ($parameter == "string") then
echo "match: $parameter"
else
echo "doesn't match: $parameter"
endif
it returns doesn't match: 0
very odd.
It is odd. In fact I tested your script but I was getting a match. I wonder if you would get the same results by using $3 in your conditional instead of assigning it to 'parameter'. It would look like this:
echo "$3"
if ($3 == "string") then
echo "match: $3"
else
echo "doesn't match: $3"
endif