✨ Updated scripts
This commit is contained in:
parent
eef4fdf99c
commit
d0aead5a9c
14 changed files with 386 additions and 99 deletions
30
scripts/wpipe.sh
Executable file
30
scripts/wpipe.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# https://www.linuxjournal.com/content/using-named-pipes-fifos-bash
|
||||
|
||||
# To be used in conjunction with rpipe.sh (demonstrating mkfifo, or named pipes)
|
||||
|
||||
pipe=/tmp/testpipe
|
||||
|
||||
if [[ ! -p $pipe ]]; then
|
||||
echo "Reader not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$1" ]]; then
|
||||
echo "$1" > $pipe
|
||||
else
|
||||
echo "Hello from $$" > $pipe
|
||||
fi
|
||||
|
||||
# Example Output:
|
||||
# $ sh rpipe.sh &
|
||||
# [3] 23842
|
||||
# $ sh wpipe.sh
|
||||
# Hello from 23846
|
||||
# $ sh wpipe.sh
|
||||
# Hello from 23847
|
||||
# $ sh wpipe.sh
|
||||
# Hello from 23848
|
||||
# $ sh wpipe.sh quit
|
||||
# Reader exiting
|
||||
Loading…
Add table
Add a link
Reference in a new issue