Skip to content

Instantly share code, notes, and snippets.

@luc-tielen
Created August 1, 2019 17:07
Show Gist options
  • Save luc-tielen/8c359dc01e3916d918e7a2ca459e4ce1 to your computer and use it in GitHub Desktop.
Save luc-tielen/8c359dc01e3916d918e7a2ca459e4ce1 to your computer and use it in GitHub Desktop.
Bash: run command passed via args on incoming connection
#!/bin/bash
nc -z 127.0.0.1 8421 &> /dev/null
#!/bin/bash
# Usage: ./server.sh echo "hello world!"
while nc -l 127.0.0.1 8421; do
eval "$@"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment