Remove pushqueue/popqueue, not compatible with bash3
This commit is contained in:
parent
4b975b5b04
commit
41ae6a5de5
@ -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 ____________________________________________________________|
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user