Hot answers tagged

46

People nowadays think of BASIC as something lesser and generally tied to puny microcomputers, but BASIC was the language of choice for many scientific, engineering and business computers in the 1970s. It had a strong foothold with mini computers, years before the microprocessors made its debut on the desktop. Think HP (Instrument) BASIC for all their ...


46

Traditionally, operating shells are relatively independent of the operating system’s function and the operating system can operate without a shell. Most shells have two modes of operation, interactive mode where they manage the command line and execute commands entered interactively, and batch mode where they run scripts. They’re “standard” programs which ...


41

ECHO ON was chosen as the default setting when interpreting batch files to preserve backwards compatibility. In PC-DOS 1.0, COMMAND.COM displayed each command as it interpreted it, and this couldn’t be disabled. ECHO was added in PC/MS-DOS 2.0, with a dual purpose (displaying messages, and controlling the display of batch file commands); its default is ON so ...


25

According to the Unix history repository, V1 had 4,501 lines of assembly code for its kernel, initialisation and shell. Of those, 3,976 account for the kernel, and 374 for the shell. For comparison, current dash has 14,455 lines of C, and the current Linux kernel has 372,988 lines of C for its core functions only (kernel, lib and mm in the kernel source ...


23

Microsoft didn’t provide anything like this for MS-DOS, but there are a number of third-party tools which can add auto-completion to the shell (along with other command-line editing features). A number of these are listed in the DOSKEY replacement section of the Free Software for DOS catalog: Toddy, CmdEdit, etc. 4DOS and FreeCOM, which are full shell ...


18

TL;DR: It's about the viewpoint these functions were designed. Command line is all about interaction Programming is about deferred execution As a result command/statement names were picked to reflect either viewpoint The long read: The function is unrelated to echoing, which is about reflecting input (possibly modified) to output But that's exactly the ...


17

It seams as if you imply that DOS is kind of an unixoide OS, which it isn't. While Microsoft's goal with MS-DOS 2.0 was to move it toward Unix like operations, for compatibility with Xenix, it never went all the way. Not in internal workings nor API or shell. MS-DOS is a single user, single program OS - with a few 'handmade' exceptions like TSR. For ...


16

This was more of a marketing question than a technical one. The historical fact is that most vendors of 8-bit personal computers chose to include BASIC. The simple answer as to why they made this choice is pretty obvious - It was the standard. So, slightly restating the question posed, one could ask "Why was BASIC the standard?" It was a standard in the ...


16

If we're not talking about BASIC as a programming language, but the operational commands that surround it, then the answer is that they surely reimplemented the command structure of existing timesharing systems that offered BASIC, in particular the 1964 Dartmouth Time Sharing System (the progenitor of BASIC). There are nits to pick, however. The "command ...


16

Because $foo may itself start with a hyphen and look like an option or an operation, which would cause misinterpretation of the command line. Using -z or -n guarantees that no matter the contents of $foo, it will never be interpreted as an option. The BSD 2.11 man page for test says: The test grammar is inherently ambiguous. In order to assure a degree of ...


15

MS-DOS doesn't support pipes like Unix does - It does support input and output redirection through its command line processor COMMAND.COM, but that's a different thing. If you're fine with pure I/O redirection, you should be able to do that using the system() function in C, by providing a command line that has the output redirection (<, >, |) included....


15

Great stuff on the the MS/PC-DOS and CP/M history in the other answers. I'd add that batch files come from the heritage (in early DOS, CP/M, and on mainframes and other systems) of script files, intended to save the "console operator" typing and allow them to leave the "console" while the potentially time-consuming steps were being sequentially executed. ...


14

The choice for the default is between seeing what's going on and not seeing what's going on. Specifically, should each command line of a batch file be shown as it's executed or not. It seems reasonable to show them to assist in debugging, rather than hide them until you know the command in the manual that turns it on. This was in the days of reading the ...


14

Yes, you should be able to interrupt a running process using the interrupt key. In Unix v6, the default interrupt key (intr) is ^?, aka DELETE, aka RUBOUT (ASCII 127). Also, the default character-erase key (erase) is #, and the default line-erase key (kill) is @. You can use stty to change the 'erase' and 'kill' keys but v6 stty doesn't let you change the ...


13

Each terminal gets its own set of processes: first getty, which sets the terminal link up and waits for a login, then replaces itself with login to handle the actual login, and finally login runs the user’s shell. So yes, each terminal gets its own shell (once a user has logged in). This doesn’t happen automatically, it’s set up by init which uses the ...


9

I can reproduce the same behavior on my A2500 with Workbench 2.1 and using the built-in AmigaDOS "Ed" command v2.00. The critical bit is the Delete ("d") protection flag. Ed's internal functionality is to delete the file then rewrite it with the modified contents. This operation fails if the "d" bit is cleared. The Execute ("e") protection bit does not ...


7

Each partition on an Amiga hard drive has settings that determine whether it is bootable and whether it should be auto-mounted. It sounds like your DH3 partition is not set for auto-mounting, and the other 3 partitions are set for auto-mounting. Furthermore, you have a "Mount" command within your boot drive's S/Startup-Sequence that is causing DH3 to be ...


7

The argument from consistency: The majority of test commands are of the form -flag value. For example, test -e foo.bar - does file foo.bar exist? test -n "$VAR" fits into that model, and is therefore consistent. The first mention of test I could find in 'man' pages is to this link to the PWB (Programmer's Work Bench) shell aka Mashey shell, it in ...


6

The 'quit' signal, though not yet called a signal, was apparently implemented in the kernel and tty driver by 1971 -- see this Unix manual, which I think must be the 1st edition, since there's also a 2nd edition manual at bitsavers, with a later date. Look for the 'sys quit' page, which as ever, is to be found in section II. To send a 'quit', type ctrl-\ ...


6

In most cases, having commands echo to the console was harmless, and helped provide a form of progress indicator for whatever task the batch file was performing. The only times that such echo would be problematic would be when the batch file was trying to format a screen layout for itself. Having a screen look like: A>echo Please type one of the ...


6

Yes, it is possible. With 4DOS at least. It involved running a BTM from within the printing of the prompt that in a loop displayed the animation(s) and waited for a keypress, upon which the normal command-line editor would take charge. I used to have a BTM file that did this. There were several in circulation, from ticking clocks to screen-saving ...


5

Is this possible with the DOS prompt command (or maybe with 4DOS) or is my memory playing tricks on me? No, it isn't. Prompt just sets a string to be interpreted and the result outputed once when the prompt is displayed (*1). Of course, one can make a string including several characters overwriting each other when displayed, creating an animation, but that ...


5

I see 3 main reasons: The 8-bit computers were targetting amateur computer enthusiasts, and a lot of beginner children. BASIC were specific to each machine to allow easy access to keyboard, sound and graphics, with simple syntax, global variables, not too many concepts like functions, scopes, etc. to avoid losing the users. Imagine having to count the ...


5

BASIC was cheap on resources. Cheap on ROM, cheap on RAM, functional and productive. Nothing else came close -- not even Forth (which really required a disk drive to be truly usable, though there were exceptions). In the microcomputer BASICs, program code and the source code were the same. The original text is consumed and parsed in to the internal token ...


4

Unlike many languages which require the use of a text editor separate from the language implementation, a BASIC interpreter includes a text editor built in. Further, someone with e.g. a VIC-20, a television set, and the manual would have everything needed to make the computer do something (e.g. play the Tank-versus-UFO game printed in the manual). ...


4

Ctrl-C, and other similar mechanisms rely on software at the receiving end reading the character, interpreting its meaning, and then sending a signal to the appropriate process. The problem with this is that if the receiving program is hung, there is a long queue of characters ahead of the ctrl-c character waiting to be processed, or there is some other ...


4

Note: This answer is to an extent speculative, and I’m not sure I can find sources for some of the claims I make here. So I cannot say for certain that this is the definitive reason. But I find it pretty plausible. The test command actually provides three forms of (non-)emptiness checking: test "$a" test -n "$a" vs test -z "$a"...


3

I started programming in 1981 at university & my first job (in 1982) was on an 8-bit Business Computer (The Durango). BASIC was one of the big three languages - FORTRAN and COBOL were compiled and on bigger computers. The expectation was that business programming was somewhat English-like. Forth had a significant presence in technical and laboratory ...


3

It wouldn't make much sense. Terminals are generally used by different people, and each one needs a shell process with a different user ID. Writing a shell able to serve multiple sessions in case a user logs in on multiple terminals would not be of much benefit as such sessions would be unlikely to be active at the same time.


3

It may be difficult to get signals to a process that's blocked on a syscall. It's possible that some early UNIXes don't know how to interrupt a syscall on receipt of a signal. In these cases you may just have to find some way to unblock the I/O device before the process blocked on it will terminate. However, you should be able to send a signal to any ...


Only top voted, non community-wiki answers of a minimum length are eligible