I'm learning Linux scripting at the moment, and one thing I can get working is assigning a command output to a variable. The command
service httpd configtest returns
Syntax is OK, so I wrote this.
#!/bin/bash var=`service httpd configtest` echo "Output is $var"
From what I've read that should store the output in
var, then echo it. However, the output when I run that script is
Syntax OK Output is
What have I done wrong? I'm using CentOS 6.5 if that makes a difference.