karlek / chell Goto Github PK
View Code? Open in Web Editor NEWA linux shell written in ANSI C.
License: The Unlicense
A linux shell written in ANSI C.
License: The Unlicense
A built-in command "checkEnv" which should execute printenv | sort | pager
if no arguments are given to the command. If arguments are passed to the command then printenv | grep <arguments> | sort | pager
should be executed.
The pager executed should be selected primarily based on the value of the users "PAGER" environment variable. If no such variable is set then one should first try to execute "less" and if that fails "more".
Any errors in the execution of the pipeline should be handled in a nice manner (i.e. similar to how your normal shell handles errors in the execution of a manually set up pipeline).
A built-in command "exit" which terminates all remaining processes started from the shell in an orderly manner before exiting the shell itself.
A built-in command "cd" which should behave exactly as a normal built-in command "cd" with the exception that you do not need explicitly to update environment variables.
cd -
is not implemented.cd ~root
is not implemented."... The only issue is that with polling the termination of BG processes is not registered if there's a parallel FG process. "
Error:
$ make; ./chell
(^._.^)ノ @ /home/_/chell $ sleep 1 &
# Wait 1 second on the next prompt, then run any command.
(^._.^)ノ @ /home/_/chell $ echo
time: 0.001s
(^._.^)ノ @ /home/_/chell $
Expected:
$ make; ./chell
(^._.^)ノ @ /home/_/chell $ sleep 1 &
# Wait 1 second on the next prompt, then run any command.
(^._.^)ノ @ /home/_/chell $ echo
time: 0.001s
[16202] job has ended.
(^._.^)ノ @ /home/_/chell $
It is common for other shells to invoke exit when the input string is EOF. The key combination [ctrl] + [d]
will send an EOF sequence. Not that the shell should not exist if [ctrl] + [d]
is pressed after a non-empty input. E.g.
(^._.^)ノ @ /home/u/Desktop/chell $ ^D
### exit ###
(^._.^)ノ @ /home/u/Desktop/chell $ ls ^D
### don't exit ###
Detection of terminated background process should be implemented by two mechanisms where one selects which should be compiled at compilation time.
The mechanisms are ordinary polling and detection by signals sent from the child processes. The user should be able to select which mechanism to use by defining a macro SIGDET=1 at compilation time to have termination detected by signals. If SIGDET is undefined or equals zero then termination should be detected by polling.
Single- (') and double- (") quotes would be nice. Then we can make git commit -m 'message'
inside chell :)
This would allow previous commands to be located using the arrow keys. E.g. press "up arrow" to get the last command.
You could also use rlwrap
to achieve the same effect.
$ rlwrap chell
(^._.^)ノ @ /home/u/Desktop/chell $ ls
chell chell.c README.md
time: 0.003s
### Pressing "up arrow" ###
(^._.^)ノ @ /home/u/Desktop/chell $ ls
It should handle the execution of processes in foreground and background. For foreground processes the total execution time for the process should be printed when it terminates. For background process information on that they have terminated should be printed no later than when the shell prompts next time after the background process/es have terminated.
There exists a buffer overflow in the parse
function, which may be triggered when more than 31 args are provided; as demonstrated below.
(^._.^)ノ @ /home/u/Desktop/chell $ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a a a a
chell: Unknown command: A
time: 0.001s
(^._.^)ノ @ /home/u/Desktop/chell $ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a a a a a
chell: Unknown command: A
time: 0.001s
(^._.^)ノ @ /home/u/Desktop/chell $ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a a a a a a
chell: Unknown command:
time: 0.001s
(^._.^)ノ @ /home/u/Desktop/chell $ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a a a a a a a
chell: Unknown command: �E�z�
time: 0.001s
(^._.^)ノ @ /home/u/Desktop/chell $ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a a a a a a a a
chell: Unknown command: �E�z�
time: 0.001s
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.