I'm trying to get it to call a function.
Here is my code
#!/bin/bash
while getopts ":a:b:" opt; do
case $opt in
a)
my_function "%e"
;;
b)
my_function "%s"
;;
/?)
echo "Invalid option: -$OPTARG"
;;
esac
done
my_function() {
option=$1
//do something here
}
When i call: ./myscript.sh -a sshd
This would display ./myscript.sh: line 5: my_function: command not found
What should I do to fix it?