ssh read output

Link to this post 03 Jun 10

With the help of ssh i would like to execute script and redirect the output in my local file

$ssh -i keypair1.pem root@<host> -C sh /mnt/ >> /root/imgManagementOutput.txt

echo `cat /mnt/imageOutput.txt`

Source: /mnt/imageOutput.txt

Expected Output:

Actual Output:
line1 line2

I am looking for the output should be as "Expected Output" as it is not in a single line...

Link to this post 04 Jun 10

Try it with

echo "$(cat /mnt/"

echo "`cat /mnt/`"

Link to this post 22 Jul 10

Why not just

cat /mnt/imageOutput.txt

Why are you echoing the output of cat? (Which itself is basically "echoing" the text file?)


Link to this post 26 Aug 10

What happens if you don't redirect the output to a file? Does it look right then? What about if you log onto <host> and run /mnt/ Does it look right when you're not piping through ssh? Try and strip away as much as you can and you'll probably find where the problem lies.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board