I'm trying to run a command in a bash variable, like this:
cmd="python -m mymodule 'argument 123 456' argument2=32 argument3=234"
$cmd
It looks like it is splitting the command line arguments in the first string even though it is surrounded with single quotes:
['argument', '123', '456', 'argument2=32', 'argument3=234']
Is there anything I can do to prevent this? I've tried to use esacped double-quotes \"
, backticks `
, but nothing works, it will still split the first command line argument on the spaces.
eval
-- it is a massive bug magnet). – Gordon Davisson Sep 20 '22 at 10:13arg="'argument 123 456' argument2=32 argument3=234"
and run withpython -m mymodule $arg
– user1506145 Sep 20 '22 at 10:23