what this statement is doing in bash?
if [ ! -p "$output" ]; then
As far as I could understand !
is a not operator, "$output"
is an variable but what -p
signifies here?
Is it a read operation on "$output"
?
what this statement is doing in bash?
if [ ! -p "$output" ]; then
As far as I could understand !
is a not operator, "$output"
is an variable but what -p
signifies here?
Is it a read operation on "$output"
?
if [ ! -p "$output" ]; then
It is checking if "$output"
is not a named pipe.
You can check help test
for all the string/file/pipe checks.
-p FILE True if file is a named pipe.
In bash
it is better and more efficient to replace [...]
with [[...]]
as [
is an external command and [[...]]
is internal construct.