a *very* odd question especially for me. Janina Sajka <janina at rednote.net> wrote

Tim Chase blinux.list at thechases.com
Thu Jul 30 13:10:01 UTC 2015


On July 30, 2015, Christopher Chaltain wrote:
> I guess I'd need to see an example of how these characters trip
> someone up in a file name using a BASH script while they are
> handled differently in the DOS batch processor. 

One of the biggest offenders I find is the exclamation point.  For
example, try the following:

  echo "Hello!"
  echo "Hello!!"

(note that the second one has two exclamation points).  The result
replaces the "!!" with the previous command, so you end up with
output of

  Helloecho Hello!

Even more confoundingly, make it an interrobang:

  echo "Hello!? I love this"

and it will hang waiting for a closing quote (even though you already
put one in) because the "!?" syntax attempts to replace the stuff
after the exclamation point with the most recent item in your
command-history that contained " I love this".


You can also have problems if you have a "$" in your text:

  echo "It cost me $5"

which attempts to replace the "$5" with the (non-existent) 5th
argument to a function/script, so it outputs merely "It cost me "

Each of them involves consistent and understandable behavior, you
just have to know what to expect.

-tim






More information about the Blinux-list mailing list