First of all, test is a reserved command name, so you'll have to change it.
Next, single-quotes in bash make everything inside them literal. So when you do
Code:
iftest='ifconfig | grep bond*'
...you're telling it to store that exact string.
And to get the value of a variable, put $ in front of it. So the output of "echo $iftest" here is going to be "ifconfig | grep bond*".
What you want to do is embed a command. The old form was to use ` backticks (note, these are not quotation marks). The newer, and preferred way is to use $().
Code:
iftest="`ifconfig | grep bond*`"
iftest="$(ifconfig | grep bond*)"
Note that in my examples I put double-quotes around the whole phrase. They work like single quotes, but allow "$" "`" and "\" to be expanded by the shell, so you can still use variables, commands, and escape sequences inside them.
For the second part, a simple "if" statement to test the contents of the variable should be all you need. You'll find lots of info on if structures in the various online tutorials.