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

Christopher Chaltain chaltain at gmail.com
Fri Jul 31 02:28:44 UTC 2015


All good points, I stand corrected. I guess I don't run into these 
special characters very often, especially in file names, and when I do, 
I fall back on a few tricks, such as using a combination of quotes or an 
escape sequence to get around these problems. I learned Pascal and 
Cbefore I did any programming in DOS batch files, so I find issues like 
these a lot less confusing then the branching and go to statements you 
have to use in DOS batch files. I guess I don't find these to be issues 
of intuitiveness as much as just what you're used to and familiar with.

On 07/30/2015 08:10 AM, Tim Chase wrote:
> 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
>
>
>

-- 
Christopher (CJ)
chaltain at Gmail




More information about the Blinux-list mailing list