GNU readline: avoid query strings in output if input is not interactive

I have a readline based application with a hint, however I would like it to not show when the input is not interactive.

$ ./readline-app < command-list > result
$ cat result
prompt> Output line 1
prompt> Output line 2
prompt>
$

How can I make the invitation not to print in this case?

+3
source share
1 answer

Use isatty(3)to determine if stdin and / or stdout are associated with tty.

+4
source

Source: https://habr.com/ru/post/1736057/


All Articles