I'm trying to write a simple script to format my man pages, but I've run into a broken pipe error.

These lines both cause the error:

env MANPAGER=cat man $foo
man -P cat $foo

and this is the script I'm ultimately trying to use (converts underlines into italics)

man -P ul "$1" | sed -e $'s/\033\\[4m/\033\\[3m/g' -e $'s/\033\\[24m/\033\\[23m/g'

I get the same problem with cat, ul, and tee, and the only thing that seems to work is less.

  • This seems to work for me on Mac OS X (10.9.4) using iTerm ( bash-3.2$ man -P 'cat -b' less | tail -n 1 1200 Version 418: 02 Jan 2008 LESS(1) – vschum Aug 23 '14 at 14:37
  • What error do you get? if I define foo=ls, then it seem to work for me. (using Debian 7). Can you add to the question the exact command and the error. – ctrl-alt-delor Aug 23 '14 at 15:17
  • I've checked some more and this seems to be specifically an iTerm2 issue with non-interactive profiles… echo is causing it too. – 0942v8653 Aug 23 '14 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.