Skip to content

Developed a custom Unix-like shell in C, supporting core functionalities like command execution, directory navigation, I/O redirection, and inter-process communication via pipes.

Notifications You must be signed in to change notification settings

jiayuyan0501/linuxShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Functions:

int err();
void cd(char* final);
void parse_args( char* line, char** arg_ary);
void exitP();
char* takeOut(char* command);
int check(char* input);
char** separateP(char* line, char** commands);
void pipe1(char** command);
void pipe2(char* cmd);
char* takeOut(char* command);
char** separateRO(char* line, char** commands);
char** separateRI(char* line, char** commands);
void separate(char* line, char** commands);
char* executeO(char* commands);
char* executeI(char* commands);

Basic Features Implemented:

  • Change Directory: changes directory to the intended path. If no path specified returns the user to home directory.
  • Exit: user exits from the shell into their regular shell following message prompting, “exiting program”
  • If the command is not exit or cd, execvp() executes the command within main in a child process. Parent process will execute the following commands in input after waiting for the child process to finish running the previous command.
  • Can handle multiple commands in one line (using semicolons)
  • If stdin contains redirect (> or <), stdin will be manipulated:
    • Inputs split into array with two commands (separated by > or <)
    • Depending on > or <, the file is redirected to stdin or stdout respectively
  • Can detect an end of file when inputting a file into ./shell.out
  • If pipe detected:
    • Output of the first command is used as input of the second command
  • Pipe can be utilized in addition to other commands (that does not also include pipe) with semicolons (;)
  • Checks if command is valid or not

Extra Features:

  • Added current directory path to prompt
  • implemented colors into user prompt
  • We attempted a < b > c but couldn’t get it to work

About

Developed a custom Unix-like shell in C, supporting core functionalities like command execution, directory navigation, I/O redirection, and inter-process communication via pipes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •