I think this is whats happening:-
When you use
Code:
hostname=`/usr/bin/hostname`
bash executes /usr/bin/hostname and stores the output in $hostname.
Then when you call $hostname in a script it will be replaced with the hosts name, in my case desktop, which is the same as executing the program hostname.
When you use
bash executes /usr/bin/ssh (without any parameters) and stores the output in $ssh.
Then when you call $ssh in a script it will be replaced with the output from ssh called with no parameters,
Code:
usage: ssh [-1246AaCfghkNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
[-D port] [-e escape_char] [-F configfile] [-i identity_file]
[-L port:host:hostport] [-l login_name] [-m mac_spec] [-o option]
[-p port] [-R port:host:hostport] [user@]hostname [command]
which is obviously not the same as executing the program ssh with any parameters you may have added.
You could test this by placing an
in your script.