Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Assignment Mini Shell
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dana-Maria CĂRUNTU
Assignment Mini Shell
Commits
22c60abd
Commit
22c60abd
authored
3 months ago
by
Dana-Maria CĂRUNTU
Browse files
Options
Downloads
Patches
Plain Diff
add conditional command execution(35p)
parent
fcde7d21
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#98736
passed
3 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cmd.c
+8
-4
8 additions, 4 deletions
src/cmd.c
with
8 additions
and
4 deletions
src/cmd.c
+
8
−
4
View file @
22c60abd
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment