diff --git a/elements/standard/script.cc b/elements/standard/script.cc index cc04a1a..8069325 100644 --- a/elements/standard/script.cc +++ b/elements/standard/script.cc @@ -396,16 +396,23 @@ Script::step(int nsteps, int step_type, int njumps) int before = cerrh.nerrors(); String result; + bool newline = true; + if (text[0] == '-' && text[1] == 'n' && text[2] == ' ') { + text = text.substring(3); + newline = false; + } if (text && (isalpha(text[0]) || text[0] == '@' || text[0] == '_')) { result = cp_expand(text, expander); result = HandlerCall::call_read(result, this, &cerrh); } else result = cp_unquote(cp_expand(text, expander, true)); - if (cerrh.nerrors() == before && (!result || result.back() != '\n')) + if (newline && cerrh.nerrors() == before && (!result || result.back() != '\n')) result += "\n"; #if CLICK_USERLEVEL || CLICK_TOOL fwrite(result.data(), 1, result.length(), f); + if (!newline) + fflush(f); if (f != stdout) fclose(f); #else