Reputation: 6039
I've written a small bash script to invoke a make
command.
The makefile expects args='<arguments to be passed to program>'
argument. (i.e. make a args='--aaa 5 --bbb 6'
)
The problem is when I use the script to invoke the make command, the argument is truncated on its first white space.
For example, when executing make a args='--aaa 5'
through the script, the args
variable is '--aaa
and not '--aaa 5'
I've also tried adding quotes and single quotes but the result is the same.
When I invoke the make
command manually through terminal the, the args
variable gets all the arguments and their values as expected.
Here is the script call :
args="args='--aaa 5 --bbb 6'"
make a ${args}
Upvotes: 1
Views: 670
Reputation: 531878
You have to double-quote $args
to preserve the whitespace.
make a "$args"
I'm assuming the Makefile correctly handles the value once it receives it.
Upvotes: 3