bash script to check if mounted, and mount if not

I'd like to make a wrapper bash script that will make sure that an nfs mount is mounted before launching a program that depends on the mount being active. Basically:

1) Check to see if the mount is active
2) If it's not active, try to mount it
3) If it won't mount because the nfs server is down, wait 45 s then try again looping indefinitely until the nfs server is up
4) Once the mount is active, run a program and exit

Can someone help me out? Here is the line to the mount in question from my /etc/fstab

192.168.2.14:/share /mnt/share nfs defaults,auto,noatime 0 0

For this you could use 'grep'. But not for output, just the exit value (meaing "$?"). Check /proc/mounts. Mount a directory. Check /proc/mounts again. Try to grep the mounted partition line from /proc/mounts.

You know the mount command, right? So if the previous 'grep' fails you could use the exit value as cue to mount it. To test the mount bit you could use a command that always outputs exit value 1: 'false'. Test it with 'false || echo doSomething; false && echo doSomethingElse'. You'll see.

"Wait" here means 'sleep'. Try 'man sleep' to find out how to use it. Again you can use a "negative" (in shell) exit value.

Same here: use the exit value.

Here's some Bash scripting guides that will help you glue those things together if you like: BASH Programming - Introduction HOW-TO, Bash Guide for Beginners,
Advanced Bash-Scripting Guide.

Once you have something to test out, posting it in code tags would make things easier in case things went awry somewhere.

I figured I could just have it run 'mount | grep 192.168' and then check to see if that is present. I don't know how to pipe the output of that into a variable though.

To store the output of a command in a variable, use command substitution:

your_wish=$( my_command )