Task is to succeed in case there's zero lines of input, but fail otherwise. Should let the input through. % seq 42 43 | sed '$q1' 42 43 % echo $? 1 % seq 42 41 | sed '$q1' % echo $? 0 %