Re: Backslashes in unquoted parameter expansions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26/03/2018 11:34, Martijn Dekker wrote:
Op 25-03-18 om 22:56 schreef Harald van Dijk:
   case /dev in $pat) echo why ;; esac

Now, bash and dash say that the pattern does match -- they take the
backslash as unquoted, allowing it to escape the v. Most other shells
(bosh, ksh93, mksh, pdksh, posh, yash, zsh) still take the backslash as
quoted.

This doesn't make sense to me, and doesn't match historic practice:
[...]

With the snipping it's not clear that I was specifically confused by the inconsistency.

I had included another example:

  pat="/de\v"
  printf "%s\n" $pat

I can understand treating backslash as quoted, or treating it as unquoted, but not quoted-unless-in-a-case-statement. What justifies this one exception?

Cheers,
Harald van Dijk
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux