This is a simple and basic implementation of a UNIX command line interpreter.
Simple_shell can interpret and execute command line arguments read from the standard input. It reads line by line from a file or the terminal line. It then interprets the lines and executes it if the line is a valid command.
All the files are to be compiled on an Ubuntu 14.04 LTS machine with:
gcc -Wall -Werror -Wextra -pedantic *.c -o sish
Once compiled, to start the program, run:
./sish
To exit the program, use the exit
command
- Basic commands:
exit
,pwd
,clear
,cd
, ... - Environment management with
setenv
andunsetenv
- Program invocation with forking and child processes
In interactive mode, simply run the program and wait for the prompt to appear. From there, you can type commands freely, exiting with either the "exit" command or ctrl-D.
In non-interactive mode, echo your desired command and pipe it into the program like this:
echo "ls" | ./sish
The program automatically exits after finishing your desired command(s).