Your program must be invoked as follows:
myshell [batchfile]
The batchfile is an optional argument. If present, your shell program will operate in the
batch mode and read the file and interpret each line of the file as commands to be executed.
If not present, your shell program will run in interactive mode by printing a prompt to the user
at stdout and reading the command from stdin.
Your shell program should handle different situations and handle them properly. The following
are examples (these are not complete):
- When the shell is run with more than one argument, the program should print an error
message and quit.
- When the bachfile does not exist or cannot be opened, the shell should print an error
message and quit.
- During the shell’s execution, when the input command is not found, the shell should
prompt a useful message and continue.
- If the input command is empty (an empty command line or only spaces between
semicolons), the command should be ignored.
- The shell should be able to handle extra white spaces between commands, arguments,
and semicolons.
- The shell should be able to handle batch file that ends without quit command or when
user types 'Ctrl-D' as command in the interactive mode.
Hi,
Few clarifications - What will be the contents of batchfile ? Is it commands ? Is Ctrl-C the only option to exit the script ? How spaces, commas, and semi colons are expected in the command.
Thanks