file-test

Bash -p — named pipe test

Identifies a filesystem FIFO, which can transport data between processes. It does not open the FIFO or establish that a reader or writer exists; opening a FIFO can block. This example creates only a private fixture. Run the example independently in a fresh private directory. Expected output (one item per line): fifo=0; file=1.

Formal Syntax & Structure

bash syntaxbash
[[ -p path ]]

Parameters & Attributes

NameTypeDescription
pathpathFile or directory pathname to inspect.

Return Value

exit status

0 for a true condition; 1 for a false condition. Invalid expressions may fail differently.

Working Example

Example Snippetbash
mkfifo channel || exit 1touch ordinary[[ -p channel ]]; printf 'fifo=%s\n' "$?"[[ -p ordinary ]]; printf 'file=%s\n' "$?"
Bash Reference