My problem is when I call my program like this it executes fine.
'/usr/local/bin/My program' -args
#or
/usr/local/bin/My\ program -args
However I want to store the command in a variable to call it from a script. I've tried several things:
> command='/usr/local/bin/My program' -args
> $command
bash: /usr/local/bin/My: No such file or directory
> "$command"
bash: '/usr/local/bin/My program' -args: No such file or directory
What's the correct way to invoke this command when stored in a variable?
Similar questions have been asked a bunch but these solutions haven't worked for me.
How do I use a variable containing a filename with spaces in a bash script?