jackbruce0 / basicshell Goto Github PK
View Code? Open in Web Editor NEWBasic Shell I built for my OS class. Handles I/O redirection, pipes, history, !$, and more!
Basic Shell I built for my OS class. Handles I/O redirection, pipes, history, !$, and more!
The command should require an already existing file and just append the processes output to specified file.
FAILS IF FILE DOES NOT EXIST
ONLY ENABLED FOR SHELL SCRIPTS
ignores rest of line when '#' is encountered
when '#' is attached to word just treat as normal character.
Jake gave me the tip that it is easier to do this if '#' is not a 'metacharacter'
Basic vertical pipe (done)
Make pipe work with file redirection (done)
New bugs will be reported as separate issues.
when !$ is entered, the last word of the previous statement shall replace it
p2 ~cs570/Data4/input21
What was sent to stdout was:
%1% %2%
Your shell did not seem to process all subsequent valid commands (echo, cd, pwd).
ERROR ERROR ERROR ERROR
(Note that the last 'cd' DID have a legal number of arguments).
###################
################### What was sent to stderr was:
Too many arguments
If your stderr message complained about confusing options, then CONGRATULATIONS
may be in order.
Of course, a human will have to judge the quality of your error/warning messages
NOTE: if lots of output lines are being duplicated, this may mean that some
child has not died properly, and has become 'a second p2 parent'.
At the moment changing directories is not supported in history
fixed:
adding history feature actually broke cd b/c I forgot
the cd block was skipping the initialization of the next line of history.
quick fix by add these initializing statements to the cd block
When last command has less arguments then a previous command. Calling that previous command yields a set fault
ex)
%1% echo 1
1
%2% ls
GradeEarly getword.h gradernotes p2 p2.h tags
getword.c getword.o makefile p2.c p2.o
%3% !1
Segmentation fault
This issue occurred because the index after ls in newargv == NULL. passing NULL to strcpy is a no no
I used strdup to solve it. (this uses malloc so may be illegal)
Test 26... does the history mechanism obey all the funny rules?
Here is the result of ~cssc0013/Two/p2 ~cs570/Data4/input97 :
The contents you sent to stdout was:
%1% last word is uname
%2% last word is uname
%3% %4%
The 'echo' command output should have appeared three times.
The 'echo' command did NOT execute 3 times. ERROR ERROR ERROR ERROR
The fourth command should have added the output of the arch command into a file
called 'arch'.
ERROR ERROR ERROR ERROR
Repeating the 4th command should have doubled the size of arch to 14 characters
ERROR ERROR ERROR ERROR
And finally, the last command should have run 'uname -v'
ERROR ERROR ERROR ERROR
All the input97 commands are legal, so there should be NO error messages.
The data you sent to stderr was:
!$: file does not exist.
ERROR ERROR ERROR ERROR
Three (six) more points were possible here; your total is now 39/42
Scoring 3 points is considered perfect, but if you got everything right,
you could actually score SIX points here!
you know what I mean
As of right now, getword does not know the difference between '\|' or '|'
ex) echo hi \| cat -> "hi | cat"
probably involves using a global flag in getword.
splint takes a shit everywhere in this project. will probably do this last
Same specs as the other append except we include error to the same output stream
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.