Why can't I print the first argument passed to my program?
arguments, bash, c
Solution
You seem to misunderstand how a pipe works. When you use a pipe like you did, the output of `app1` is used as `stdin` for `app2`, but not the command line argument for `app2`.
It's like this:
stdin->app1->stdout >----------> stdin->app2->stdout
pipe
Problem
I made a simple code in c: ``` #include <stdio.h> int main( int argc, char* argv[] ) { printf( "Hello, just wanted to say: %s.\n", argv[1] ); return 0; } ``` and made two programs from it - `app1` and `app2`. Now, I'm experimenting with pipelines: ``` ./app1 Bye | ./app2 ``` and the output put into `%s` is `(null)` instead of expected "Hello,". Why?