I'm not sure what you want it to do exactly, but an if statement is really quite simple.
Code:
if <test>; then
commands
fi
<test> can actually be any command. What
if looks at is the exit code of the command used. If the exit code is 0, then the subsequent commands are executed. The most common command used here is, of course,
test, which simply exits with 0 if the expression inside it evaluates as true. The
[ ] brackets are actually a synonym for
test.
So if you want to know whether a variable holds a certain string, then simply use a string comparison.
Code:
if [ "$var" = string ]; then
It's usually best to quote variables, which preserves whitespace and reserved characters.
However, your
isin sounds more like a partial string match, which is a bit more difficult. In that case you usually need to use bash's extended
[[ ]] test mechanism. This allows regex matches, among other advanced comparisons.
Code:
if [[ "$var" =~ substring ]]; then
I generally use the extended test for all my scripts, as it's more robust overall.
All of this is explained in the Bash Beginner's Guide page you're looking at. If you want more specific help, you'll have to give us more details.