Shell quote

I'm not new to the shell, but still messed up with some of the not-so-difficult issues with quotes. There must be something incomprehensible.

a: echo 'Don\'t quote me // Don    quote me
b: echo Don'\t' quote me // Don    quote me
c: echo Don\t quote me   // Dont quote me
d: echo Don"\t" qoute me // Don    quote me

The above three quotes go completely against my intuition. Does the single quote give '...'what is quoted? I thought it was ...

For a: in single quotes 'Don\', \is nothing more than a common character. So a) should be Don\t quote me.

For b: like a), '\t'suppressed a special meaning \t, so I thought that b) should also be Don\t quote me.

In c: I understand why c works, but does not understand the difference between a & b and c.

For d: is there no difference between 'and "?

Perhaps I misunderstand how to shellparse and execute a command line.

/bin/echo (built-in)echo Mac. .

+3
2

bash

  • Don\t quote me
  • Dont quote me
  • Don\t qoute me

:

  • ,
  • \t
  • scaping, \t \as is
  • double quote does not scape scape characters
+3

, , , echo OSX - , escape- escape-. , shopt -u xpg_echo.

. : AppleScript?

+3

All Articles