homme.io
Clean.Precise.Quick.
..
PAX ROMANA
SAKURA
Фотография
Философия
Искусство
История
C/C++
DBMS
Oracle
Спорт
Linux
Lua
IT

Infinitum.Aeterna
2024.Китай
Иран в лицах
2023.Иран
2023.06.Москва
2023.Стамбул
2023.ЗИМА
2022.11.Турция
2022.ОСЕНЬ
2022.08.Зубовка
2022.07.Турция
2022.Раменское
2022.ЛЕТО
2022.Архангельское
2022.Парк 50-летия Октября
2022.Санкт-Петербург
2022.Ярославль
2022.03.Зубовка
2022.Кокошкино
2022.Сочи
2022.ВЕСНА
2022.02.Царицыно
2022.Стамбул
2022.02.Коломенское
2022.ЗИМА
2021.Зубовка
2021.ОСЕНЬ
2021.Египет
2021.Раменское
2021.ЛЕТО
2021.Дивеево
2021.Азов
2021.02.Зоопарк
2021.Карелия
2020.Санкт-Петербург
2020.Турция
2020.Аносино
2020.Азов
2020.Верея
2020.Арктика
2020.Греция
2019.Турция
2019.Зубовка
2019.Дагестан
2019.Дагестан+
2019.Египет
2019.Италия
2019.Куликово поле
2019.Калуга
2019.02.Танцы
2019.Байкал
2018.Переславль
2018.Плес
2018.Березка
2018.Крым
2018.Азов
2018.Калининград
2018.Санкт-Петербург
2018.Эльбрус
2017.Турция
2015.Египет
2013.Египет
2013.Рим
Разное

Work with named pipe

In the i-pipex1 example, the cat command sets up a message handler routine and the echo command acts as the requestor.
i-pipex1

# Named Pipe Example 1.
#
# Create named pipe...
mknod trypipe p
# Open named pipe and read message...
cat trypipe &
# Write message...
echo "This is a message!" > trypipe
# Delete pipe...
rm trypipe
To try this example, run the shell script, i-pipex1. This script performs the following actions:
1. The mknod command creates a named pipe called trypipe.
2. The cat command opens trypipe for reading. It blocks because trypipe has not yet been opened for writing. Notice that an ampersand (&) is present at the end of the cat command; this runs the cat command as a background process.
3. The echo command opens trypipe for writing and writes a message. The cat command, blocked until now, resumes execution, and the message appears on the display.
4. The rm command deletes trypipe.

 

#! /usr/bin/env bash
pipe=/path/to/pipe
[ -p "$pipe" ] || mkfifo -m 0600 "$pipe" || exit 1
while :; do
    while read -r cmd; do
        if [ "$cmd" ]; then
            printf 'Running %s ...\n' "$cmd"
            # sh -c "$cmd" sh
        fi
    done <"$pipe"
done


And here: https://www.linuxjournal.com/content/using-named-pipes-fifos-bash

sdmrnv, 2019-06-04 [0.786ms, s]