Tuesday, January 19, 2016

bash ssh magic with heredoc

I don't yet understand this:


ssh user@server "$( cat <<'EOT'
echo "These commands will be run on: $( uname -a )"
EOT
)"

But it probably is a good way to send args to a program as a block.
Seems like the chars between the 'EOT' are piped as input into the program that is before the <<

See this as one of the answers to
http://stackoverflow.com/questions/7114990/pseudo-terminal-will-not-be-allocated-because-stdin-is-not-a-terminal


No comments:

Post a Comment