[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: %q with truncating size loses safeness of %q
From: |
Greg Wooledge |
Subject: |
Re: %q with truncating size loses safeness of %q |
Date: |
Fri, 17 Apr 2020 20:03:15 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Sat, Apr 18, 2020 at 05:37:52AM +0700, Robert Elz wrote:
> The end result is as Greg said, "Don't do that", if precisions are
> needed with %q do something like
>
> printf 'echo %q%q\n' "$(printf %.2s "a'b")" ';ls'
Or something like printf '%q\n' "${myvar:0:2}"
since I would assume the content to be truncated-and-quoted is in a
variable.