basically reading in /etc/vfstab|manipulating it a couple times with sed, grep and cut to get the data I want in the format I want and then save it to a .txt file on the server I ran the command from.
however with respect to
$HOSTNAME
it outputs the hostname of the server the command was run on, not the name of the remote server. I'm stumped. I've tried it with
There were a few similar posts in forum Shell Programming and Scripting - The UNIX and Linux Forums
I propose two separate scripts, this avoids the quoting chaos with remote execution.
Just make a simple "remote_script", that will run on the remote host:
You had one script,
and passed the second script as an argument to ssh - problem.
While I suggest two separate scripts.
ssh directly reads the "remote_script" via stdin - the current shell does not see it and cannot do substitutions.
So the /bin/bash on the remote system first sees and substitutes variables in the "remote_script".