Skip to content

Instantly share code, notes, and snippets.

@tweekmonster
Created September 26, 2015 01:42
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 tweekmonster/3d0e35baaf813435c3fc to your computer and use it in GitHub Desktop.
Save tweekmonster/3d0e35baaf813435c3fc to your computer and use it in GitHub Desktop.
Monitor FIFO pipe with Bash
#!/bin/bash
echo -en "${@}\x04" > /tmp/fifo_queue
#!/bin/bash
pipe="/tmp/fifo_queue"
trap "rm -f '${pipe}'" EXIT
bytes=""
while true; do
IFS= read -r -d $'\4' bytes 2> /dev/null
if [[ -z "$bytes" ]]; then
sleep 0.1
continue
fi
echo "'$bytes'"
done < $pipe
@Maruskakonst
Copy link

Bralå görbta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment