Created
September 7, 2014 19:00
-
-
Save KensoDev/e28729099b420487f73a to your computer and use it in GitHub Desktop.
read_pipe.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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