I am trying to do a command, but I need to get a command line argument. Here is my problem:
This is the code:
pl_function(){
node=$(echo "$1" | awk -F'\.' '{print $2}')
echo $node
}
I have a case statement:
case "$1" in -pl.*)
pl_function
;;
esac
When I run this, it prints a blank.
Also, I would like to include getopts, in order to not care about the order of the arguments. Let's say I have -location followed by an argument and -grep followed by argument and -def_location followed by no argument.
How can I use getopts in this case?