Reputation: 7080
Is it possible to open ssh connect in bash script and send commands through it when it needed.
I want to put some logic between commands and use one connection.
Upvotes: 2
Views: 1494
Reputation: 88583
With a here document:
#!/bin/bash
ssh user@server << EOF
echo $HOSTNAME
hostname
echo Hello
EOF
Upvotes: 1