Skip to content

Instantly share code, notes, and snippets.

@KensoDev
Created September 7, 2014 19:00
Show Gist options
  • Save KensoDev/e28729099b420487f73a to your computer and use it in GitHub Desktop.
Save KensoDev/e28729099b420487f73a to your computer and use it in GitHub Desktop.
read_pipe.sh
#!/bin/bash
DEFAULT_PIPE_NAME=".plumber"
PIPE_NAME="${1:-$DEFAULT_PIPE_NAME}"
if [ ! -p $PIPE_NAME ]; then
echo "Created pipe ${PIPE_NAME}..."
mkfifo $PIPE_NAME
fi
echo "Waiting for commands!"
while true; do
COMMAND=$(cat $PIPE_NAME)
echo Running ${COMMAND}...
sh -c "$COMMAND"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment