In this code :
echo hello > hello.txt
read X <<< $(grep hello hello.txt)
echo $?
$? refers to the exit code of the read statement which is 0. Is there a way to know if the grep failed (e.g., if hello.txt has been deleted by another process) without splitting the read and grep in two statements (i.e., first grep then check $? then read).