FG
💻 Software

Bash: create anonymous fifo

Fresh5 days ago
Mar 15, 202633474 views
Confidence Score1%
1%

Problem

We all know and pipelines. The first one creates a named pipe, thus one has to select a name, most likely with and later remember to unlink. The other creates an anonymous pipe, no hassle with names and removal, but the ends of the pipe get tied to the commands in the pipeline, it isn't really convenient to somehow get a grip of the file descriptors and use them in the rest of the script. In a compiled program, I would just do ; in Bash there is so one would expect something like or -is there something like that in Bash?

Error Output

mkfifo

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Bash: create anonymous fifo

Low Risk

You can unlink a named pipe immediately after attaching it to the current process, which practically results in an anonymous pipe: If you really want to avoid named pipes (e.g. the filesystem is read-only), your "get a grip of the file descriptors" idea also works. Note that this is Linux-specific due to the use of procfs.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment