Does it exist a standard linux terminal program that when given text input (in standard in) returns a 1 and 0 if no text is provided? (The reverse logic would also be fine).
Example
echo hello | unknown_program # returns 1
echo | unknown_program # returns 0
>Solution :
grep -q '.' will do this. . matches any character except newline. grep returns a 0 static code (success) if there are any matches, and 1 if there are no matches.
echo hello | grep -q '.'; echo $? # echoes 0
echo | grep -q '.'; echo $? # echoes 1