executing shell command in background from script

Viewed 163707

how can I execute a shell command in the background from within a bash script, if the command is in a string?

For example:

#!/bin/bash
cmd="nohup mycommand";
other_cmd="nohup othercommand";

"$cmd &";
"$othercmd &";

this does not work -- how can I do this?

4 Answers

For example you have a start program named run.sh to start it working at background do the following command line. ./run.sh &>/dev/null &

Related