dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir N. Oleynik" <dzo@simtreas.ru>
To: dash@vger.kernel.org
Subject: single_quote patch
Date: Fri, 29 Jan 2021 22:56:37 +0400	[thread overview]
Message-ID: <695d664f-98dc-17be-9bec-55250391e296@simtreas.ru> (raw)

Hello.



I rewrote (next version vs send to Herbert) single_quote()

for do not confusing in debug mode, more funny

showvars and showalias and allow the printf "%q" directive.



Before patch

$ ./dash-0.5.11.3 -x



$ foo () { local a=" b"; ls "$1"; [ -z "$1" ]; }

$ c=" x" foo

+ c= x foo

+ local a= b

+ ls

ls: cannot access '': No such file or directory

+ [ -z  ]



After patch

$ ./dash-0.5.11.3.my -x



$ foo () { local a=" b"; ls "$1"; [ -z "$1" ]; }

$ c=" x" foo

+ c=' x' foo

+ local a=' b'

+ ls ''

ls: cannot access '': No such file or directory

+ '[' -z '' ']'




Before patch
:
$ a= b="a'b" c=a/b

+ a= b=a'b c=a/b

$ set +x; set | grep '^[abc]='

a=''

b='a'"'"'b'

c='a/b'


$ printf "%q\n" "a'b"

dash: 32: printf: %q: invalid directive



After patch

$ a= b="a'b" c=a/b

+ a= b="a'b" c=a/b

$ set +x; set | grep '^[abc]='

a=

b="a'b"

c=a/b


$ printf "%q\n" "a.b" "a'b"

a.b

"a'b"





The patch placed: ftp://simtreas.ru/pub/my/dash/single_quote_diff.txt.gz
(I can not send this patch to maillist - message dropped)


--w

vodz


                 reply	other threads:[~2021-01-29 18:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=695d664f-98dc-17be-9bec-55250391e296@simtreas.ru \
    --to=dzo@simtreas.ru \
    --cc=dash@vger.kernel.org \
    --subject='Re: single_quote patch' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).