So you should be able to save your script as say "openWifiCap.sh" in the /opt directory ("/opt/openWifiCap.sh" is now the full path to the script) and then have it executed at boot by placing a call to the script in the "/etc/rc.local" file.
First off, once you've saved the script make sure to run the command "sudo chmod +xw openWifiCap.sh" to make it executable (the +x) and give it write permissions (the w).
At this stage you should be able to run "./openWifiCap.sh" and it should work as expected.
Next, add in a call to the script in the in the "/etc/rc.local" file. By default, this file should look something like this:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
You'll want to add the call to the script above the line with "exit 0". With it done, it would look like this:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sh /opt/openWifiCap.sh &
exit 0
The "sh" at the start will call the script and the "&" at the end of the line will get the script to run in the background.
If you still have issues with that method you could try the other. Take a look at the answers here for a decent run through of how to do that.