4

I have been reading the posts I found about shell, terminal, bash but I get more and more confused about these terms.

Does DOS have a shell, like the bash in Linux?

Is this the DOS shell, a shell that shows a command line?

FreeDOS screenshot

Also in this case, the terminal is the keyboard and the monitor if I understand correctly?

phuclv
  • 26,555
  • 15
  • 113
  • 235
Koray Tugay
  • 1,882
  • 7
  • 23
  • 38

3 Answers3

6

Yes. The shell is pointed to by the variable COMSPEC. For example in MS-DOS the default shell is COMMAND.COM which is stored on the root folder of the system drive

COMSPEC or ComSpec is one of the environment variables used in DOS, OS/2 and Windows, which normally points to the command line interpreter, which is by default COMMAND.COM in DOS or CMD.EXE in OS/2 and Windows NT

Imgur

You can see the variable in Windows even though DOS is not available because it may be used to run shell commands from an executable or a script

C:\Users\user>set comspec
ComSpec=C:\Windows\system32\cmd.exe

As mentioned above, COMMAND.COM is the default shell but you can always change it and/or add additional parameters in CONFIG.SYS using SHELL or SHELLHIGH

SHELL=C:\DOS\COMMAND.COM C:\DOS /E:512 /P

For example FreeDOS doesn't store the shell at the root level but its own directory

FreeDOS shell

Many alternative shells for DOS like have been produced to add many useful features like auto completion, ANSI commands... The most famous one being 4DOS

4DOS is a replacement for command.com, the command processor included in most versions of DOS, far more powerful and flexible, however, than this feeble program. After many years of being commercially successful, 4DOS is now made available for free by its author, Rex Conn of JP Software, at their Downloads Page. It's officially unsupported, though the support forum will generally try to answer your questions.

https://www.4dos.info/4dinfo.htm

phuclv
  • 26,555
  • 15
  • 113
  • 235
  • In DOS, "The shell is pointed to by the variable COMSPEC" *sometimes*. Sometimes the variable is blank. It was considered an optional (and recommended) variable, but not always set. – TOOGAM Apr 04 '16 at 06:35
  • Your output is `ComSpec=C:\Windows\system32\cmd.exe` is CMD not DOS. And his question is clearly talking about DOS.. Then you include DOS too. If mentioning windows's cmd it should be as an aside(if at all). Not first thing. – barlop Mar 18 '18 at 22:01
4

A shell is simply a means to access an OS' features/services, and can be either command line i.e. text-based or GUI-based. DOS' shell is thus its command line interface (CLI) and command interpreter (command.com), that displays the standard DOS prompt. The shell generally runs on top of a text terminal, accepting data from a keyboard and displaying output on a monitor (among other I/O devices).

1

phuclv
  • 26,555
  • 15
  • 113
  • 235
Karan
  • 55,947
  • 20
  • 119
  • 191
  • 1
    What do you mean "The shell generally runs on top of a text terminal"? – Koray Tugay Jun 11 '15 at 08:40
  • 1
    A text terminal is just a computer interface for text entry and display. The shell runs on top of it as in utilises it to accepts input and display output. The display could just be a dumb terminal and actual OS operations will be executed by the CPU of course. – Karan Jun 11 '15 at 08:48
  • 1
    This is a very good answer. I will just point out that Unix and Linux work nearly identical when it comes to their text terminal and GUI implemetations when compared to MSDOS and Windows 3.1/95/98/ME. – Ramhound Jun 11 '15 at 10:53
  • can you give an example of a text terminal with no shell? – barlop Mar 18 '18 at 22:04
  • @barlop I'm not sure about on Windows, but on the Unix and Linux side of things, most terminal apps can be configured to run a specific program on launch. Typically they run the user's login shell, but they could be configured to run some non-shell program. Alternatively, you could use the `exec` command to replace your currently running shell with a non-shell program, e.g. `exec cat` would result in a text terminal running the `cat` program and no shell. – 8bittree Jul 29 '19 at 20:41
3

Yes. The shell in DOS is the COMMAND.COM program.

Andrew Lambert
  • 7,635
  • 3
  • 30
  • 47