Thứ Ba, 18 tháng 1, 2022

How to solve “unmatched double quote” error using dbus-monitor in combination with xargs

 From man xargs:

--delimiter=delim
-d delim
      Input  items  are terminated by the specified character.  Quotes
      and backslash are not special; every character in the  input  is
      taken  literally.   Disables  the  end-of-file  string, which is
      treated like any other argument.  This  can  be  used  when  the
      input consists of simply newline-separated items, although it is
      almost always better to design your program to use --null  where
      this  is  possible.   The  specified  delimiter  may be a single
      character, a C-style character escape such as \n, or an octal or
      hexadecimal escape code.  Octal and hexadecimal escape codes are
      understood as for the printf command.   Multibyte characters are
      not supported.

As an example:

$ echo '"""' | xargs
\xargs: unmatched double quote; by default quotes are special to xargs unless you use the -0 option
$ echo '"""' | xargs -d '\n'
"""

$ echo '"""' | xargs -d ' ' 
"""

Of course, using either may break things, but perhaps not as much as -0.

Share This!


Không có nhận xét nào:

Đăng nhận xét