Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- pipe=/tmp/ffmpeg
- trap "rm -f $pipe" EXIT
- # creating the FIFO
- [[ -p $pipe ]] || mkfifo $pipe
- while true; do
- # can't just use "while read line" if we
- # want this script to continue running.
- read line < $pipe
- # now implementing a bit of security,
- # feel free to improve it.
- # we ensure that the command is a ffmpeg one.
- [[ $line =~ ^ffmpeg ]] && bash <<< "$line"
- done
- echo "ffmpeg -version" > /tmp/ffmpeg
- if [[ -p /tmp/ffmpeg ]]; then
- echo "ffmpeg -version" > /tmp/ffmpeg
- else
- echo >&2 "ffmpeg FIFO isn't open :/"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement