▪️Understand Minishell

What is a shell ?

We have to build a minimalist shell, I think the best thing to start with is to understand what a shell is.

This is a good definition of a shell I found on reddit (link to it below)

A shell or command shell is a program which has a special purpose: it reads keystrokes from the keyboard and interprets the "commands" that it receives in this way. The general idea is to have a human user interact with the command shell in order to accomplish system or computer maintenance related tasks, such as manipulating files or altering the configuration settings for various subsystems.

One particular task of a command shell is to locate and start up other applications which have a specific task. For instance, you can start a web browser or a word processor program by typing in the appropriate name.

Shells also typically are able to execute "batch files" or "shell scripts" which are text files that contain a series of commands that you would otherwise type in one after another. In this way you can automate repetitive tasks such as making a backup of a particular directory, or checking that the amount of disk space left is adequate.

Knowing shell commands (both the built in commands and the utility programs) comes in handy when you are a system administrator. In my own experience (I have been my own linux system administrator for almost fifteen years) I can accomplish certain tasks way more efficiently using the keyboard issuing commands than firing up an application and shoving the mouse around.

Linux in particular has several sophisticated command shell programs, of which my personal preference is bash. Windows traditionally has not given much attention to being able to perform tasks using a command shell. An MS-DOS like solution has always been the default. OS/2 had a pretty nifty command shell, but no one is using that anymore (where is the other half? - guffaw). But these last few years I hear Windows has a command shell solution that aims to be at least as good at what linux has to offer. I have never worked with it, so I have no opinion to offer.

Source: https://www.reddit.com/r/explainlikeimfive/comments/1vu6g7/eli5_shell_computing/

Last updated