This is my linux shell program written in c. I will post a download link of the PDF of the code soon. :)
=============================================INTRINSIC COMMANDS
cd - prints the current working directory.
cd <directory>
echo - print rest of line as comment. (e.g echo helloworld)
environ - list the shell environment by having the built-in pointer: extern char **environ
pause - wait for the user to press ENTER key to continue
quit - quit the shell
help - print this help script
=============================================
ALIASES
clr - clear the screen
dir - list the contents of current working directory
dir <
=============================================
I/O REDIRECTION
(e.g sort > outfile)
programname >> outputfile - stdout is redirected to outputfile. The file is automatically created if it does not exist, and appended if it does which means that the output is appended to the last line of the file's contents.(e.g sort >> outfile)
command < inputfile > outputfile - read from inputfile, execute the program/command and truncate the output to outputfile.
command < inputfile >> outputfile - read from inputfile, execute the program/command and append the output to outputfile
===============================================
SCRIPT SUPPORT
The shell can read commands from a file when ./myshell batchfile is entered in the OS command prompt wherein batchfile
===============================================
BACKGROUND EXECUTION
An ampersand (&) at the end of command line will make the shell return to the command line prompt immediately after launching that program. (e.g programname &). By default, commands are executed in the foreground. After one background execution, it will revert to foreground execution.
===============================================
ENVIRONMENT VARIABLES used in this shell
PWD - contains the full pathname of the current working directory. The value can be changed
SHELL - contains the full pathname of the myshell. At the instant that myshell is opened the SHELL environment is changed
PARENT - the programs are executed with the PARENT environment containing the full pathname of myshell
*UPDATE download link of the code in pdf is now available (07-31-10)
Preview
Comments
Post a Comment