3 ms·
Thanks for your inputs. A few comments: I first created that script called m years ago on some Unix boxes that I was using. Could have been HP-UX or other ver
by vram22 9y ago
Thanks for your inputs. A few comments:
I first created that script called m years ago on some Unix boxes that I was using. Could have been HP-UX or other version. And I've used it over the years on many Unix and Linux versions that I worked on. It could be that in some cases, the script is needed due to a tty or TERM or other configuration issue. But I'm pretty sure that I've had the need for it (to remove those control characters) on at least some systems where such config was okay. I know this because, while I do tweak env. var., stty and other settings now and then, I do not always (need to) do so, and have still found control chars [1] in the man output, even when redirecting to file. That is why I created the script, because when working on a C, Python or any other project where I need to read man pages, I often like to redirect the man output to a file (in my ~/man dir) and then read them using vi/vim.
[1] See what I say in that post (about m) about nroff and troff.
Also, I do know about stty, have used it for years, although there is less need for it these days. Used to do a lot of tweaking and experimenting with the erase option (for which, BTW, instead of backspace key in your example, we can also write a literal ^h, i.e. caret, then letter h), intr option, onlcr, ocrnl and others. Used to be good fun and sometimes frustrating too, because docs for this areas were somewhat lacking then.
- vram22 9y agoAlso see the man page for the col command, which is used in my m script: http://man7.org/linux/man-pages/man1/col.1.html http://man7.org/linux/man-pages/man1/col.1.html
- laumars 9y agoI don't make a habit of commenting on shell scripts what I haven't first read. But thank you all the same. I used to use 'col' alot to resolve the tabs Vs spaces problem with different actors imposing different preferences in their source code. It's a handy tool but often overlooked.
- vram22 9y ago>I don't make a habit of commenting on shell scripts what I haven't first read. But thank you all the same. Sorry, I should have added "if you haven't already read it", in my earlier comment. >I used to use 'col' alot to resolve the tabs Vs spaces problem with different actors imposing different preferences in their source code. It's a handy tool but often overlooked. Interesting, I may not have noticed or known about the tabs option of col. Cool. Seems it is like the entab program in an edition of the K&R C book. https://www.google.co.in/search?q=kernighan+and+ritchie+c+programming+language+entab+program https://www.google.co.in/search?q=kernighan+and+ritchie+c+pr...
- laumars 9y agoYeah I'm familiar with groff et al. I used to get this issue on old UNIX boxes but not seen it in any of the Linux distros I use daily (not Freebase). The other thing worth trying is seeing whether your locals are set correctly and/or set the GROFF_TYPESETTER environment variable. Though this might only by GNU specific. Or just redirect the output (as suggested by the other reply) which is how I used to get around the issue on SunOS at least.
- vram22 9y agoI don't think I have any GROFF* variables set. Thanks again.