Comment

Comment by kazinator

This is going to confuse the frankfurter out of a newbie. First it presents the idea that Windows has a shell, and even multiple shell programs. Screenshots 'n' everything.

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:

  echo $BASH_VERSION
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:

  $ echo 'all of # this is seen'
  all of # this is seen
"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:

  $#               (dollar hash) number of positional parameters

  ${variable#pat}  expand the content of variable, chopping off
                   a leading portion which matches the pat pattern.
                   Example:

                     $ echo $TERM
                     xterm-256color

                     $ echo ${TERM#xte}
                     rm-256color
parent kazinator 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton