Created
September 3, 2015 03:45
-
-
Save evilchili/53e9a74d6320c7066bb3 to your computer and use it in GitHub Desktop.
redirect STDIN to a file on the host where your current SSH session originated. put it in your .bashrc!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example 1: | |
# laptop% ssh remotehost | |
# remotehost% uptime | laptop remote_uptime | |
# remotehost% exit | |
# laptop% cat remote_uptime | |
# 20:41:11 up 9 days, 4:02, 20 users, load average: 0.02, 0.01, 0.00 | |
# | |
# In other words, it's like starting this: | |
# laptop% ssh remotehost uptime > remote_uptime | |
# but from the remote host. | |
# | |
function laptop() { | |
ssh $(echo $SSH_CLIENT|cut -d' ' -f1) "cat - > $1" < <(cat) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works too!