This comprehensive overview provides details on external and internal commands implemented in the shell, along with error-handling mechanisms. Additionally, test cases and assumptions are outlined to guide users in utilizing the shell effectively.
- ls -a
- ls -m
- cat -n
- cat -E
- date -u
- date -I
- rm -v
- rm -i
- mkdir -p
- mkdir -v
- cd ~
- cd ..
- echo *
- echo --help
- pwd -L
- pwd -P
- Command Not Found: If the user enters any command other than the specified ones.
- No Such File or Directory: In cat and rm commands for non-existing files, and in cd for non-existing directories.
- Invalid Option: If the user enters an option not handled by the shell.
- Missing Operands: In cat if the user enters it without any argument.
- Cannot Create Directory: In mkdir if the user tries to create a duplicate directory.
- Fork Error (Child Process Not Created): Error handling for creating a child process using the Fork System Call.
The shell can be implemented using both forks and threads. If someone wishes to use threads, they can add &t
at the end of the command. For example:
ls -a &t
cat -n cat.c &t
date -I &t
ls -a
&ls -a &t
ls -m
&ls -m &t
cat -n cat.c
&cat -n cat.c &t
cat -E cat.c
&cat -E cat.c &t
date -u
&date -u &t
date -I
&date -I &t
rm -v hello.c
&rm -v hello.c &t
rm -i hello.c
&rm -i hello.c &t
mkdir -p newDir/newDir2
&mkdir -p newDir/newDir2 &t
mkdir -v newDir
&mkdir -v newDir &t
- No unnecessary arguments will be passed in between or after the command.
- cat and rm commands will not be passed a directory as an argument.
- mkdir and rm commands will not be entered without any arguments.