Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anujkaushal/3214066b1604f0c5664bdf881d678395 to your computer and use it in GitHub Desktop.
Save anujkaushal/3214066b1604f0c5664bdf881d678395 to your computer and use it in GitHub Desktop.
How to open server bash inside a local shell script
#!/bin/bash
var1="important-value"
echo "SEVER BASH - stats here"
ssh -i ./key.pem user@example.com <<-SSHBASH
echo "Successfully connected to example.com"
ls -l ./public_html/index.html
echo "Echo Var1 Value: $var1"
SSHBASH
echo "Successfully disconnected from example.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment