Add export builtin
This commit is contained in:
parent
d35e7e4b38
commit
c4f6fc8edd
|
@ -125,6 +125,12 @@ int parse_command(char **command, int status) {
|
||||||
}
|
}
|
||||||
} else if (!strcmp(command[0], "pwd")) {
|
} else if (!strcmp(command[0], "pwd")) {
|
||||||
printf("%s\n", pwd);
|
printf("%s\n", pwd);
|
||||||
|
} else if (!strcmp(command[0], "export")) {
|
||||||
|
for (int i = 1; i <= position - 1; i++) {
|
||||||
|
status = putenv(command[i]);
|
||||||
|
if (status != 0)
|
||||||
|
return status;
|
||||||
|
}
|
||||||
} else if (!strcmp(command[0], "!")) {
|
} else if (!strcmp(command[0], "!")) {
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
status = 0;
|
status = 0;
|
||||||
|
|
Loading…
Reference in New Issue