# This is another simple script which shows that ‹ssh› can also be # used for moving data across the network, like ‹nc›, but much more # securely. Of course, there is some overhead involved, but in 98% # of the cases, ‹ssh› is a much better choice. set -x # First notice that ‹ssh› works non-interactively if we give it a # command to execute, like this: ssh aisa echo hello world # Of course we can pipe the output to a (local) command: ssh aisa echo hello world | cut -f1 -d' ' # We can also pipe stuff to the ‹stdin› of ssh and it appears as the # ‹stdin› of the remote command, like the following. Unfortunately, # we have to do double escaping, because the command is given to a # shell at the remote end, but the quotes were already stripped by # the local shell (when constructing ‹argv› for ‹ssh›). echo hello world | ssh aisa "cut -f2 -d' '" # That's all for ‹ssh›. Let's move on to ‹curl› and then finally some C: # # $ micro curl.sh