linux-sysprog · beginner · ~15 min
Relate pipe symbols to process count.
Implement int pipeline_stages(const char *cmd) returning the number of commands in a pipeline — the number of '|' characters plus one. An empty string has 0 stages.
int pipeline_stages(const char *cmd) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.