r/ProgrammingPrompts • u/henryponco • Nov 13 '14
Write Your Own Shell!
Write your own shell thread!
Inspired by the common second/third year university assignment, designed to teach you about processes, IPC and handling user input.
A shell is a command line interpreter, it takes commands from the user and executes them. A common example is Command Prompt on Windows or Bash often found on *NIX systems.
Checkout Wikipedia for more information on a shell (though if you're unfamiliar with what a shell is this may be too difficult for you).
Foreground and Background execution (&) Unnamed pipes ( | ) Input/output redirection (< and >) Comments (#) Built in commands (cd, exit, ?)
I did this assignment in third year and it was a blast. I recommend using C or C++ for this programming prompt. It could easily be implemented in many other languages too, though. There are plenty of resources on the web like this: http://linuxgazette.net/111/ramankutty.html
Will update when not on mobile. Sorry for not including more of a spec.
If you're an up and coming programmer who is interested in this post below and I'll write up a how to and my solution
View all comments
Show parent comment
0
u/henryponco Feb 09 '15
Hi mate,
Well unfortunately Java is not really suitable for this sort of job. To the best of my knowledge Java does not support 'exec' or similar so writing a "bash style shell" would be difficult.
I may be wrong but what I had in mind would is not really possible in Java.
If you were interested in giving C/C++/Python a go then this might be the project for you. Java is just a little too high level without an inbuilt 'exec' function.
Sorry I couldn't help more!