Skip to content

Instantly share code, notes, and snippets.

@lucenarenato
Forked from vluzrmos/remote-ssh-write.sh
Created August 20, 2021 13:02
Show Gist options
  • Select an option

  • Save lucenarenato/3341d70f8200eefd6d9430a0a77b0804 to your computer and use it in GitHub Desktop.

Select an option

Save lucenarenato/3341d70f8200eefd6d9430a0a77b0804 to your computer and use it in GitHub Desktop.
Write into a SSH Remote File
#!/bin/bash
echo 'Some Text' | ssh user@remotehost -T "cat > /remotefile.txt"
# The -T disables pseudo-terminal allocation and stops you from getting the message,
# Pseudo-terminal will not be allocated because stdin is not a terminal.
# @see https://superuser.com/a/400720/341320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment