To directly display the output from a command in a bash script (do not forget to set executable on the file $chmod u+x bashtest.sh) Where bashtest.sh is the name of the script file.
#List home directory (note the back ticks)
echo `ls -l ~`
#Store command output as a variable
i=`ls -l ~`