Question

Can somebody suggest me, how to collect output of man command in tcl?

I am writing :-

set hello [ man {command-name}]

and when am executing the script, the program gets halted and man commands start running in the foreground, prompting the user to "press RETURN" again and again till it gets completed.

Was it helpful?

Solution

You're just missing the exec command

set output [exec man cmd-name]

When you do set out [man cmd-name] in an interactive tcl session, the unknown command will intercept the 'man' command and implicitly perform an exec on it. In that scenario, 'man' somehow knows you're interactive and pipes the manpage through your $PAGER.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top