This is a readme file for MYSH : A simple shell created in c by Ayush, Yugansh & Ojasvin. Period.
- General Description
- Compiling
- Flow of control
- Other details
Three main steps for a shell is:-
- Get the command from standard input.
- Parse it into arguments and function.
- Execute required job.
Execute shell code by typing :-
$ make mysh
Clean the output by typing :-
$ make clean
Execute shell code by typing :-
$ ./mysh
Program begins with executing "mysh_userinterface();" in main(), which is a continuos loop, breaks on status FALSE. In this "mysh_read_line(); " reads a line from the keyboard, mysh_split_line() splits it into command + arguments amd "mysh_execute();" execute the command and looping continues until exit is encountered.
In mysh_execute() it runs two types of command one is builin and other is default terminal command. For eg, cd is a builtin command which cannot be executed by a child process forking system because it will only change the directory of the child process which executes it. Parent process directory is not changed.
timerun command -- > this command is used to kill a running process after a particular time.
Syntax :- timerun <process_name>
eg :- timerun 2 ./a.out
this command will execute ./a.out for two seconds and then kill it.