Skip to content

Instantly share code, notes, and snippets.

@brownman
Created November 12, 2013 12:14
Show Gist options
  • Select an option

  • Save brownman/7429854 to your computer and use it in GitHub Desktop.

Select an option

Save brownman/7429854 to your computer and use it in GitHub Desktop.
Question: How to send a message between 2 terminal windows ? _ Solution 1: a Bash echo server/client _ dependencies: ncat,cowsay
#!/bin/bash -x
work="$1"
port=2000
host='0.0.0.0'
cmd1='cowsay'
if [ "$work" = 'server' ];then
ncat -v -l -p $port -k -c "xargs -n1 $cmd1"
elif [ "$work" = 'client' ];then
ncat "$host" $port
else
echo 'supply 1 argument: server/client'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment