Suppose my parent script is called with n arguments, and I want to pass all arguments from argument #3 to the child script.
How do I do that in bash script?
I know $@ would get you the entire argument list, which is not what I want.
Use shift to remove the first two arguments:
shift 2
child_script "$@"
If you need to use $1 and $2, you can save them in variables first.
Another option is to assign the arguments to an array:
args=("$@")
remove the first two elements of the array:
unset args[0]
unset args[1]
Then call the child script with this array:
child_script "${args[@]}"
$1 and $2 later in the file? SHould I just save their values in a separate variable?