I am writing a Bash Script wherein I need to run some set of commands on a remote Linux server from my local computer using SSH. I want the results to be displayed on the terminal screen or dump the results in a file on my local system.
How can achieve this? Is the following syntax correct?
\#!/bin/bash . . . . ssh <user>@<remote_host> 'COMMAND >> /path/to/file ; scp /path/to/file <user>@<local_host>:<location>; exit' . .
Thanks in advance.