I have an application that accepts input from stdin, let's call this application suman-f which can be run via the command line. I'd like to limit the input to the real human user only and not allow input from automated programs. The reason for this is because if multiple processes are sending information to stdin, it will get garbled, as there is only one information channel but multiple communicators.Is there a way to prevent anything but a human executing suman-f via a terminal?Or if there is some magical way to multiplex stdin, I'd love to hear about it.
Only allow living breathing user to issue a command
bash;shell script;shell;terminal;tty
Short answer is no.Unix system has no way to know if stdin of a particular process is handled by a human.ttyyour best approximation is tty. (see man tty).tty (terminal) are the way to interact with system ( see What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'? ).This is how it worksif tty -sthen    echo a human might be reading or not)else    echo output is a filefiin other wordif tty -s return false, you know output is a file (not a user),if tty -s return true, you don't know.This allow different formating (like ls), or prevent from interactive usage.