2
0

Remove pushqueue/popqueue, not compatible with bash3

This commit is contained in:
Maarten Billemont 2014-10-23 17:29:14 -04:00
parent 4b975b5b04
commit 41ae6a5de5

View File

@ -465,44 +465,6 @@ readwhile() {
# ___________________________________________________________________________
# |__ pushqueue ______________________________________________________________|
#
# pushqueue element ...
#
# Pushes the given arguments as elements onto the queue.
#
pushqueue() {
[[ $_queue ]] || {
coproc _queue {
while IFS= read -r -d ''; do
printf '%s\0' "$REPLY"
done
}
}
printf '%s\0' "$@" >&"${_queue[1]}"
} # _____________________________________________________________________
# __________________________________________________________________________
# |__ popqueue ______________________________________________________________|
#
# popqueue
#
# Pops one element off the queue.
# If no elements are available on the queue, this command fails with exit code 1.
#
popqueue() {
local REPLY
[[ $_queue ]] && read -t0 <&"${_queue[0]}" || return
IFS= read -r -d '' <&"${_queue[0]}"
printf %s "$REPLY"
} # _____________________________________________________________________
# ______________________________________________________________________ # ______________________________________________________________________
# |__ Latest ____________________________________________________________| # |__ Latest ____________________________________________________________|
# #