Run a string as a command within a Bash script Run a string as a command within a Bash script bash bash

Run a string as a command within a Bash script


You can use eval to execute a string:

eval $illcommando


your_command_string="..."output=$(eval "$your_command_string")echo "$output"


I usually place commands in parentheses $(commandStr), if that doesn't help I find bash debug mode great, run the script as bash -x script