Dear Monks,
once again a little talk in the CB made it to the SoPW...

I'm currently writing a program that uses the ncurses library. It's use is to show a list of bookmarked directories and/or fast browse thru the filesystem within the console and then print the result to STDOUT. In that way a simple bash-alias like

alias cb='cd `theprog`'
would enable me to browse my important directories really fast. (OK, the full-featured alias does some parameter passing, too).

The first version of that script printed the list to STDERR and the result to STDOUT. Worked fine, but not comfy. The second used ANSCI escape sequences and was much more featured. Some day I decided to bloat that little script by using the curses lib, coded many hours and -when I was almost thrugh with the main functionality- I started it with the real alias and ... nothing happened :((

As far as I can see (and the talk in CB showed) you don't have terminal control within the subshell that is opened for the backticks.

I have found that midnight commander has a similar example in it's manpage (description of the -P switch) and they use a tmp-file for that.

Are there any other (more elegant) ways and/or tricks to get a ncurses programm to execute within the backticks?

Thanks and...

Regards... Stefan


In reply to NCurses From The Backticks by stefan k

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.