R
Rocky Zhou
I wonder is there any way to make the wrapper program can wrap options
&& arguments for the the subprocess/command the wrapper will
execute? by getopt or optparse module?
This is something like the shell script like this:
optwrap=""
while [ $# -gt 0 ]; do
case $1 in
-a) do-something; shift
;;
-b) do-something; shift
;;
*) optwrap="$optwrap $1 $2"
# collect the option and argument
shift
;;
esac
shift
done
$command $optwrap
# execute the command with $optwrap as subprocess
I want that all the options and arguments which are feed to this
scripts command line will be used by executing the sub command.
I need this because I now have finished a fs_backup script written in
python, it will execute tar && find to complete full and
differentiating/incremental backup for the file system level files,
and their restoring. This script will do different things by the
command line arguments, and execute find/tar in different ways, but
for being more flexible, I want some options of tar/find can also been
specified from the command line directly, and the script just transmit
those to tar/find simply.
Is there anyone can give me some advices?
Thank you.
&& arguments for the the subprocess/command the wrapper will
execute? by getopt or optparse module?
This is something like the shell script like this:
optwrap=""
while [ $# -gt 0 ]; do
case $1 in
-a) do-something; shift
;;
-b) do-something; shift
;;
*) optwrap="$optwrap $1 $2"
# collect the option and argument
shift
;;
esac
shift
done
$command $optwrap
# execute the command with $optwrap as subprocess
I want that all the options and arguments which are feed to this
scripts command line will be used by executing the sub command.
I need this because I now have finished a fs_backup script written in
python, it will execute tar && find to complete full and
differentiating/incremental backup for the file system level files,
and their restoring. This script will do different things by the
command line arguments, and execute find/tar in different ways, but
for being more flexible, I want some options of tar/find can also been
specified from the command line directly, and the script just transmit
those to tar/find simply.
Is there anyone can give me some advices?
Thank you.