Posted by Tim Galyean in Bash
on May 4th, 2010
This script is pretty simple in its functionality, however it shows how you can utilize passing bash arguments to get different results, or to call different functions within the script.
In this example we are just echoing out the argument that is being passed, but only if it matches what the script is looking for. These types of functions are particularly useful if you have a multi function script which changes its behavior depending on the arguments which are passed to it.
#!/bin/bash
function init() {
if [ "${1}" == "string1" ]; then...