https://blog.nullspace.io/batch.html
Powershell is a new arrival, limited outside of Windows. I admit that I don't know it.
The POSIX shell also has severe problems with ambiguity, and it is not an LR-parsed language:
https://archive.fosdem.org/2018/schedule/event/code_parsing_...
Use the right tool for the job, imperfect as they may be.
It is unfortunate that awk didn't grow and supplant the shell, as for many years the BWK "One True Awk" did use straightforward lex and yacc grammars.
It’s actually based on the DOS command shell [1], which in turn was modeled after CP/M [2].
"For example, on OS/2 and Windows, it can use real pipes in command pipelines, allowing both sides of the pipeline to run concurrently. As a result, it is possible to redirect the standard error stream. (COMMAND.COM uses temporary files, and runs the two sides serially, one after the other.)"
Obviously, this process and I/O management would require a massive rewrite, sufficient to make cmd.exe a new (but somewhat compatible) implementation. This was not possible in DOS or CP/M.
Delayed variable expansion, pushd/popd, file name completion, expression evaluation and improved control structures are all fundamental changes that are strongly influenced by the Berkeley C Shell written by Bill Joy. The wiki specifically mentions the C Shell.
The 8086(/8) binary for command.com is not found in modern windows (I think the "wow16" layer was removed from 64-bit windows); cmd.exe is a 32-bit binary running under wow32, which it must be to invoke these new features in system calls that could not exist in DOS.
The wiki says this about the relation between command.com and cmd.exe:
"cmd.exe is the counterpart of COMMAND.COM in DOS and Windows 9x systems, and analogous to the Unix shells used on Unix-like systems."
I think that very little source code from command.com ended up in cmd.exe.
It is compatible with, but distinct from what preceded it.
I've linked to this post/comments on the repo (issue #210), they should all get addressed but it might be a while before the online version gets sorted, I'm closing out the final chapters online, once I've done this I'll likely go back to the beginning and rewrite/edit/put in a more consistent style (more code snippets, fewer screenshots etc).
I disagree with all of them from an educational point of view.
Having said that, it helps to clarify whether the audience is technical or education oriented. The title implies a technical book, so I'm with you on the comments.
This author doesn't have a chance in a room full of newbies. You have to have your technical dope straight, and it's not enough.
$ echo foo#bar
foo#barexplorer.exe uses the "ShellApi" to do some of its things, which applications can also use, like launching a file via its associated application (ShellExecute/ShellExecuteEx).
(I personally wouldn't write a book about the shell. I would be too paralyzed by the thought that at any moment, Stéphane Chazelas might crack it open.)
But then, nope:
> Windows is not anything like Linux under the hood. So to get a shell working, we have three options:
> Use a tool which provides common Linux tools which have been written to work with Windows
> Use a "virtual machine" running Linux
> Use the Windows Subsystem for Linux
What "common Linux tools which have been written to work with Windows" is referring to is installing Cygwin.
This a fairly hamfisted presentation of a subject matter that could be handled in a way that is simultaneously easier to grasp and factually correct.
First of all, your goal is to teach about a specific command interpreter language, you really want to clarify how there are multiple ones which have different syntax, and brush that whole topic aside as fast as possible.
> You can see what the version is of your shell by running:
> bash --version
Yikes. If we know we are running Bash, the way to know what version it is is:
and not to run another instance of Bash.Can this book teach something simple, like comments?
> The shell ignores any text which follows a # hash symbol.
Wrong:
"this is seen" looks like an example of "any text" to me.A hash comment marker is ignored if it is not quoted and escaped so as to be part of a word. The hash is also part of certain bits of syntax: