[root@worm ~]# cat MainProgram.sh #!/bin/sh Execute () { echo -e "Executing $@ ..."; $@; } Execute "./getopts.sh -P 'hello world'" ./getopts.sh -P 'hello world' [root@worm ~]# cat getopts.sh #!/bin/sh while getopts "P:" i do case "$i" in P) VAR="$OPTARG"; continue;; *) echo $usage; exit 1;; esac done echo $VAR [root@worm ~]# ./MainProgram.sh Executing ./getopts.sh -P 'hello world' ... 'hello hello world