I have a list of arguments and three processes:
bash_script -> child -> grandchild
The list of arguments is aimed at the grandchild. I can modify all three processes. The grandfather script gets one argument for itself.
Is the following a proper way to pass the remaining arguments to the grandchild?
#!/usr/bin/env bash # This is the grandfather first_arg="$1" shift 1; export MY_ARGS="$@"
I "spread" the env variable later, in the child process, as part of the command that calls the grandchild, something like:
grandchild --foo "$MY_ARGS" # append $MY_ARGS as arguments to foo