Setting the Results of a Command to a Variable

Hi,

Hi, I run the command:

hostname to get the host back from the server: db201

Now, I need to take that result and set it to a variable. Can anyone help me with this?? I need to be able to use the same script on multiple servers so I do not want to hardcode the hostname result into the variable.

Can anyone please help?!

Thanks in advance!

MYHOST=`hostname`
echo "$MYHOST"