PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] many escape chars in a row
Date: Sunday, 27 Sep 2020, 08:30:44


    > Message Posted By: Unknown
    >
    > I was testing many escape characters in a row to understand their
    > behavior, and I came across this example:
    > echo hello \\\\; echo world
    > > hello \
    > > world
    >
    > Why is the output not the following?
    > > hello \\
    > > world
    >
    > Because I thought the first \ escapes the second \ (thus printing \) and
    > the third \ escapes the fourth \ (printing a second \). But only one \ is
    > printed.

As you can verify by writing a program that echoes its
arguments, what the shell passes is "hello\\".  However,
echo appears to be converting the \\ to a single \.

--Stan-
PREV INDEX NEXT