I am writing a bash script
foo.sh that runs too commands
bar with first input argument, and
baz with the second argument:
#! /bin/bash bar "$1" baz "$2"
Now I want to make
foo.sh more flexible, having optional number of arguments for
baz, something like the below:
./foo.sh bar_args="-x -v message=hello" baz_args="-d -m"
And I want
foo.sh to pass
bar_args as the input arguments to
baz. I want also
foo.sh to work normally if either of the arguments were not given (for instance if
bar_args is not provided,
bar should be called without any arguments).
How to do this?