Reputation: 4027
I have a bash script I've written to automate something tedious, so I got the command looking right in echo, but when I run it, it doesn't work. This is what I'm doing:
CMD='custom_script update --flag=value --comment="testing"'
echo -e "Running $CMD"
$CMD
The echo shows: custom_script update --flag=value --comment="testing"
which is correct, but that is not what is actually run with the $CMD line (I know because if I copy and paste the output from echo, it works, but the error message after running in the script suggests the quoting is off).
I think I can figure this out if I can see the command run by $CMD, but I don't know how to do that.
Upvotes: 0
Views: 106
Reputation: 2779
Run it like
bash -x script.sh
or modify the shebang like
#!/bin/bash -x
Upvotes: 3