Skip to content

Instantly share code, notes, and snippets.

@ulymarins
Created July 31, 2016 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ulymarins/783fcbef4cd9d66fb061029a92a1a801 to your computer and use it in GitHub Desktop.
Save ulymarins/783fcbef4cd9d66fb061029a92a1a801 to your computer and use it in GitHub Desktop.
Simple bash script created to access some server via ssh and execute sudo commands.
#!/bin/bash
HELLO="world"
ssh -t user@target bash -c "'
ls
pwd
if true; then
echo $HELLO
else
echo "This is false"
fi
echo "Hello world"
sudo ls /root
'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment