Skip to content

Instantly share code, notes, and snippets.

@goldeneggg
Created December 11, 2014 02:35
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 goldeneggg/600768b8ca1abd0e4f3a to your computer and use it in GitHub Desktop.
Save goldeneggg/600768b8ca1abd0e4f3a to your computer and use it in GitHub Desktop.
bash組込機能である /dev/tcp を使ってnetcat風の通信処理を行うサンプル(IRC)
#!/bin/bash
-
##########################################################
# IRCにJOINするサンプル
NICK="YOUR_NICK"
SERVER="YOUR_SERVER"
CHANNEL="YOUR_CHANNEL"
PORT=6667
##########################################################
# Main
exec 3<>/dev/tcp/${SERVER}/${PORT}
echo "NICK ${NICK}" >&3
echo "USER ${NICK} 8 * : ${NICK}" >&3
echo "JOIN ${CHANNEL}" >&3
cat <&3
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment