Skip to content

Instantly share code, notes, and snippets.

@mooperd
Created July 13, 2013 07:58
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 mooperd/5989918 to your computer and use it in GitHub Desktop.
Save mooperd/5989918 to your computer and use it in GitHub Desktop.
#!/bin/bash
exec 3<> /dev/tcp/${1:-localhost}/4949
printf "list" >&3
printf "\r\n" >&3
while read -ra line <&3
do for word in "${line[@]}"
do printf 'fetch %s\n' "$word"
while read -r fline <&3
do [[ $fline = . ]] && break
echo "got $fline";
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment