Contents
How to redirect stdin output to another process?
You want to (1) create stdout output in one process (like echo ‘…’) and (2) redirect that output to stdin input of another process but (3) without the use of the bash pipe mechanism. Here’s a solution that matches all three conditions:
What should I type into the stdin to produce an EOF?
I have a C program. What should I type into the stdin on the terminal to produce an EOF? In Windows, Control+Z is the typical keyboard shortcut to mean “end of file”, in Linux and Unix it’s typically Control+D. EOF is wrapped in a macro for a reason – you never need to know the value.
How to send a string to stdin in Bash?
Here’s a solution that matches all three conditions: /my/bash/script < < (echo ‘This string will be sent to stdin.’) The < is normal input redirection for stdin. The < (…) is bash process substitution.
How to enter the value of Eof in the terminal?
1 EOF is wrapped in a macro for a reason – you never need to know the value. 2 From the command-line, when you are running your program you can send EOF to the program with Ctrl – D (Unix) or CTRL – Z (Microsoft). 3 To determine what the value of EOF is on your platform you can always just print it: printf (“%i\ “, EOF);
How to pipe multiple lines to stdin in Bash?
Enables one to type multiple lines into a program, without that input being saved in history, nor visible in ps. Just press Ctrl + C when finished typing to end cat. aliases can and can’t process piped stdin…
Which is normal redirection for stdin in Bash?
The < is normal input redirection for stdin. The < (…) is bash process substitution. Roughly it creates a /dev/fd/… file with the output of the substituting command and passes that filename in place of the < (…), resulting here for example in script < /dev/fd/123. For details, see this answer.