How can I store an argument vector with an argument containing spaces in a bash variable?
For example, I want 2.sh to print b c
1.sh
#!/bin/bash
ARGV='a "b c"'
./2.sh $ARGV
2.sh
#!/bin/bash
echo $2
|
|
|
You should use an array instead of a string:
When the array expansion is quoted, each element of the array is properly expanded. |
|||
|
|