Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh/
- WKDIR=$(realpath ~)
- sed_script='${WKDIR}/test_sed_script'
- cmd_script='${WKDIR}/cmd_sed_script'
- local fifo="/var/tmp/getoptions.$$.$RANDOM"
- mkfifo $fifo || {
- echo "$(basename $0): getoptions: Error creating named pipe. Exiting." >&2 exit 2 }
- ( sed -f "$sed_script" "$fifo" >$fifo ; rm -f $fifo ) &
- trap 'echo Received SIGPIPE >&2' SIGPIPE
- globalvar=
- while read; do
- # first loop :
- done < <($cmd_script)
- ## do something with globalvar
- #while read; do
- # #second loop :
- #done <$fifo \trap - SIGPIPE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement