I am simply trying to gather information about the system, specifically the hostname, OS, and SSH version. I created the following script and it sets the hostname and OS but instead of setting the SSH command as variable, it executes it and I can't figure out why.
Here is the script
#! /bin/bash
set -o xtrace
rm -f ssh.log
HOSTNAME=$(hostname)
OS=$(uname -s)
SSH_VER=$(ssh -V)
echo $HOSTNAME $OS $SSH_VER > ssh.log
cat ssh.log
Here is the output of script...
+ rm -f ssh.log
++ hostname
+ HOSTNAME=localhost.localdomain
++ uname -s
+ OS=Linux
++ ssh -V OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
+ SSH_VER=
+ echo localhost.localdomain Linux
+ cat ssh.log localhost.localdomain Linux