I\'m trying to redirect command output to a variable:
OUTPUT=$(sudo apache2ctl configtest)
and then to read it:
echo $OUTPU
maybe the output goes to stderr, not stdout?
stderr
stdout
try this: OUTPUT=$(sudo apache2ctl configtest 2>&1)
OUTPUT=$(sudo apache2ctl configtest 2>&1)