I have a series of commands connected together with pipes:
should_create_one_line | expects_one_line
The first command should_create_one_lineshould output output that has only one line, but under strange circumstances, the output may be multi-line or empty.
I would like to add a step between the two validate_one_line,:
should_create_one_line | validate_one_line | expects_one_line
If its input contains exactly 1 line, then it validate_one_linewill simply output its input. If its input contains more than 1 line or is empty, it validate_one_lineshould lead to a stop of the entire sequence of steps and the return of an error code.
Which command can I use for validate_one_line?
source
share