You don't pass quoted arguments to a command, you pass arguments.
When you enter:
cmd arg1 arg2
The shell parses that line in its own syntax where space is a word delimiter and calls
arg2 as arguments.
cmd does not receive any space character in its arguments, the spaces are just operators in the shell language syntax.
Like when in C, you write
func("foo", "bar"), at run time,
func receives two pointer arguments, it does not see any of the
" or space character.
Also part of the shell syntax is quoting.
" is used to be able to have words that contain characters that are otherwise part of the shell syntax.
When you do:
cmd "arg 1" arg2
arg 1 and
arg2 as arguments. It does not see any
" character. Those
" are used to prevent the space from being treated as a word separator in the shell syntax.
Now, when you do:
it's not the same as doing:
cmd the content of the variable
If it were, you'd have trouble with:
In Bourne-like shell, the content of
$VAR is not passed verbatim as a single argument to
cmd either (unfortunately; it's been fixed in some other shells like
fish and to a lesser extent
zsh). Instead, it's subject to splitting and globbing (
split+glob) and the resulting words passed to
The splitting is done based on the characters in the special
$IFS variable, by default space, tab and newline.
$ARGUMENTS which contains
-executors 1 -description "The Host", that's splitting into
Host". Since none of those words contain wildcard character, the glob part doesn't apply, so it's those words that are passed to
Here, you could use the
split+glob operator, and use as separator for the splitting part a character that does not appear in those words:
Or better, for shells that support them (like
bash), use arrays, where you can have a variable that contains all those arguments.
eval is to evaluate shell code. So the other option is to have
ARGUMENTS contain shell code (text in the shell syntax as opposed to a list of arguments), and have that passed to
eval for interpretation. But remember to quote the variable to avoid the split+glob operator:
eval "cmd $ARGUMENTS"