how can I execute in a correct way a python script that has many parameter within a bash script?
I have tried this:
#!/bin/bash
CMD="/home/blabla.py --spec standard --id blabla --type car --wait 6 --priority normal --custom ' --tag blabla&&!klingklong --conf /home/team/blabla.yaml ' "
$CMD
Note: the above command is example with parameter values as they are created in previous steps of the bash script. I reality the command looks like this:
CMD="/home/blabla.py --spec ${SPEC} --id ${ID} --type ${TYPE} --wait ${WAIT} --priority ${PRIORITY} --custom ' --tag blabla&&!klingklong --conf /home/team/blabla.yaml ' "
So, I first create all the command end then I am trying to execute it. In a next step I would even add variable for --tag and --conf.
If I copy the command and I execute it directly in a shell it will execute without any issues.
But executing the bash script it complains about the parameters in --custom which are in ''.
What I have observed is that when executing in shell the --custom parameters are acknowledged and correct add to a variable custom of the /home/blabla.py
custom=' --tag blabla&&!klingklong --conf /home/team/blabla.yaml'
But this does not happen when executing from a bash script!
blabla.py: error: unrecognized arguments: --tag blabla&&!klingklong --conf /home/team/blabla.yaml '
I notice that at the above error printout I see at the end "'"
Any idea? Do I need to escape any character or use double brackets?