Skip to content
Snippets Groups Projects
Commit 22c60abd authored by Dana-Maria CĂRUNTU's avatar Dana-Maria CĂRUNTU
Browse files

add conditional command execution(35p)

parent fcde7d21
No related branches found
No related tags found
No related merge requests found
Pipeline #98736 passed
......@@ -273,14 +273,18 @@ int parse_command(command_t *c, int level, command_t *father)
/* TODO: Execute the second command only if the first one
* returns non zero.
*/
break;
if (parse_command(c->cmd1, level, c) != 0) {
return parse_command(c->cmd2, level, c);
}
return 0;
case OP_CONDITIONAL_ZERO:
/* TODO: Execute the second command only if the first one
* returns zero.
*/
break;
if (parse_command(c->cmd1, level, c) == 0) {
return parse_command(c->cmd2, level, c);
}
return 0;
case OP_PIPE:
/* TODO: Redirect the output of the first command to the
* input of the second.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment