Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm connecting to a simple server which is offering a basic text-based interface using socat like this

socat readline TCP4:localhost:8090

There are some initial commands I have to execute every time I connect, and I would like to automate this. Is there some way to have socat execute these automatically before going back to readline-mode? Or is there some other program better suited to this purpose?

share|improve this question
up vote 2 down vote accepted

A simple script can be written:

#!/usr/bin/env bash
exec {fd}<>/dev/tcp/
echo "command" >&$fd
echo "other command" >&$fd
exec socat readline fd:$fd
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.