help-bash
[Top][All Lists]
Advanced

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

How to make `read` fail if there is not enough fields in the input?


From: Peng Yu
Subject: How to make `read` fail if there is not enough fields in the input?
Date: Thu, 5 Dec 2019 10:12:17 +0800

I’d like to know whether there is enough field in a TSV row. But the status 
code does not return an error code. Is there a way to let read return non-zero 
if there is not enough fields? Thanks.

$ IFS=$'\t' read -r x y <<< x
$ echo $?
0


Regards,
Peng


reply via email to

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