File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
usr/libexec/helper-scripts Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 66br_add () {
77 local in out
88
9- if (( $# != 1 )) ; then
10- printf ' %s\n' " br_add: requires exactly one argument " >&2
9+ if (( $# > 1 )) ; then
10+ printf ' %s\n' " br_add: too many arguments " >&2
1111 return 1
1212 fi
1313
14- in=" $1 "
14+ if (( $# == 1 )) ; then
15+ in=" $1 "
16+ else
17+ in=" $( cat) "
18+ fi
19+
1520 # # Replace each newline with "<br />\n"
1621 out=" ${in// $' \n ' / ' <br />' $' \n ' } "
17-
1822 printf ' %s\n' " $out "
1923}
2024
@@ -203,7 +207,12 @@ test2"
203207test2"
204208 actual_result=" $( br_add " $input_string " ) "
205209 if ! [ " $expected_result " = " $actual_result " ]; then
206- error " br_add failed!"
210+ error " br_add command failed!"
211+ fi
212+
213+ actual_result=" $( printf ' %s\n' " $input_string " | br_add) "
214+ if ! [ " $expected_result " = " $actual_result " ]; then
215+ error " br_add pipe failed!"
207216 fi
208217}
209218
You can’t perform that action at this time.
0 commit comments