Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16163

Re: %q with truncating size loses safeness of %q

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: %q with truncating size loses safeness of %q
Date 2020-04-17 20:03 -0400
Message-ID <mailman.555.1587168200.3066.bug-bash@gnu.org> (permalink)
References <4bacf2f0-9802-67d3-f30b-80e37d058a4a@case.edu> <CAOj-5WCqxqh=Gcda9k6y4orQaQYXPgsOgNEOVN1AdZQrkCVbtg@mail.gmail.com> <22039.1587163072@jinx.noi.kre.to> <20200418000315.GU845@eeg.ccf.org>

Show all headers | View raw


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.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: %q with truncating size loses safeness of %q Greg Wooledge <wooledg@eeg.ccf.org> - 2020-04-17 20:03 -0400

csiph-web