r/ProgrammingPrompts • • 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

21 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Feb 09 '15

Well I'm writing mine anyway c: Here are the commands so far (This is what comes up when you type /?)

  • Quit - Exit App
  • Create - Create new File /n x - Specifies new file, where x is the Directory
  • Math - Calculator /m x x - Multiply, where x are whole numbers /d x x - Divide, where x are whole numbers /a x x- Add, where x are whole numbers /s x x- Subtract, where x are whole numbers
  • List - List Files /d x - Specify the input of a Directory, and where
  • Delete - Delete File /d x - Specify the input of a Directory, and where
  • Write - Write to a Text File /n x - Specifies the representaion of the Directory of a File /t x - Specifies the input text, where x is a String
  • Open - Open file, such as Notepad /d - File directory for file you want to open