4820 p1 milestone 3
You cannot submit for this problem because the homework's deadline is due.
Final Pretest
Memory leaks and undefined behaviors are not tested in the final pretest.
All of the test cases are very basic input, and we'll give hints on many common errors.
Tasks
12. Handle errors for all supported features. [10]
- Case: 1-10
- At most one of these error occurs in a command
- Non-existing program (Case 1)
- input:
non-exist abc def
- input:
echo abc | non-exist
- output:
non-exist: command not found
- input:
- Non-existing file in input redirection (Case 2)
- input:
cat < non-existing.txt
- output:
non-existing.txt: No such file or directory
- input:
- Failed to open file in output redirection (Case 3)
- input:
echo abc > /dev/permission_denied
- output:
/dev/permission_denied: Permission denied
- input:
- Duplicated input redirection (Case 4)
- input:
echo abc < 1.txt < 2.txt
- input:
echo abc | grep abc < 1.txt
- output:
error: duplicated input redirection
- input:
- Duplicated output redirection (Case 5)
- input:
echo abc > 1.txt > 2.txt
- input:
echo abc > 1.txt >> 2.txt
- input:
echo abc > 1.txt | grep abc
- output:
error: duplicated output redirection
- input:
- Syntax Error (Case 6)
- input:
echo abc > > > >
- output:
syntax error near unexpected token `>'
- input:
echo abc > < 1.txt
- output:
syntax error near unexpected token `<'
- input:
echo abc > | grep abc
- output:
syntax error near unexpected token `|'
- input:
- Missing program (Case 7)
- input:
> abc | | grep 123
- output:
error: missing program
- input:
cd
to non-existing directory (Case 8)- input:
cd non-existing
- output:
non-existing: No such file or directory
- input:
4820 p1 milestone 3
- Status
- Finished
- Problems
- 6
- Open Since
- 2022-09-19 00:00
- DDL
- 2022-10-16 23:59
- Extension
- 72.0 hour(s)