help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to tell < file apart from any other redirection within a bash functi


From: Peng Yu
Subject: How to tell < file apart from any other redirection within a bash function?
Date: Sun, 8 Mar 2020 15:54:42 -0500

Hi,

I'd like to tell the first case apart from all other possible cases.
a_bash_func is a bash function.

a_bash_func < a_file

Other cases,

cmd | a_bash_func
a_bash_func < non_file(maybe a fifo or something else other than file)
...

Is the following the best way to perform such a test to know whether
it is the first case within a_bash_func? Thanks.

[[ -f /dev/fd/0 ]]

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]