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


Groups > gnu.bash.bug > #15549

Feature Request: Custom delimeter for single quotes

Path csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Patrick Blesi <patrick@ble.si>
Newsgroups gnu.bash.bug
Subject Feature Request: Custom delimeter for single quotes
Date Thu, 31 Oct 2019 23:54:55 -0500
Lines 35
Approved bug-bash@gnu.org
Message-ID <mailman.160.1572591096.13325.bug-bash@gnu.org> (permalink)
References <CAOnw=2J6fse6U=6zofMW7pORp0yTere_DYYSKGS6hf5xK2PuQA@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1572591097 26314 209.51.188.17 (1 Nov 2019 06:51:37 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=ble.si; s=default; t=1572584109; bh=duwIMfEkgij3T0QpREl6M8FHeRDsfqR7HE/yfX12Omw=; h=From:Date:Subject:To:From; b=gayBC47bvd/9bJz+tfwObfmbvYfbbFMVlUeKHOl7KidXaRYaeSvHA4w1I+VlBBmP/ VOq9liD6zuC5A01cxsZ3XvYw2WaFymBigbXAFBorCu4BlKySfQRWKw8tUVES2zKUI5 8d3IgyeZ2lGwDoLg5w6vSeMz0R+QA87NftGGAYU4=
X-Virus-Scanned Debian amavisd-new at personyms.com
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=ble.si; s=default; t=1572584108; bh=duwIMfEkgij3T0QpREl6M8FHeRDsfqR7HE/yfX12Omw=; h=From:Date:Subject:To:From; b=fhEmaMAoaj4E12TgBprpkHbzA/KfefOydYKGx7PoiFvCfFIJR9JASQ7teYlBwyjfx usXzeyfjSBU8CjdoyRscpWteJ5/qhKxsc/tpGfN+C5AXRHi/8pGUUuZN9DFVZQttnE 9IlZM8YTu3946IrKQ94e37mYWA88Mgc5ja190wXQ=
X-Gm-Message-State APjAAAVwndK7zm++2D2rEw0rJl+DGS0CzsYKH4qzMzGJxD/8IEp1hGDd 0YeTEtPW6P8TDX5r9CMjh3pq8jksbm6616lrTkc=
X-Google-Smtp-Source APXvYqzzKMk3ROS4NYwhbHDDOlaghkf66BcStMjgXsECYtZmk8YdcSpR7p1Kch9brvEeHnmGyvMon7Mv7QfbHpWJ6Zk=
X-Received by 2002:a17:906:1910:: with SMTP id a16mr2012262eje.11.1572584106889; Thu, 31 Oct 2019 21:55:06 -0700 (PDT)
X-Gmail-Original-Message-ID <CAOnw=2J6fse6U=6zofMW7pORp0yTere_DYYSKGS6hf5xK2PuQA@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 45.56.123.183
X-Mailman-Approved-At Fri, 01 Nov 2019 02:51:31 -0400
X-Content-Filtered-By Mailman/MimeDel 2.1.23
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAOnw=2J6fse6U=6zofMW7pORp0yTere_DYYSKGS6hf5xK2PuQA@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15549

Show key headers only | View raw


I'm looking for a hybrid between single quotes and a here doc or here
string.

The main use case is for accepting arbitrary user-specified text. I would
like to wrap this text in single quotes so as to prevent any variable
expansion or interpretation of the text of any kind. Additionally, I would
like to allow the users to include single quotes in their text without
requiring that they escape these quotes.

Something akin to the following would alleviate the need to communicate
that users must escape single quotes, but also provide the same literal
string behavior of single quotes.

presuming the arbitrarily substituted text is:

echo 'this command is specified by the user'

Then a syntax for this single quote heredoc behavior could be like:

$ sh -c <<^MAGIC_WORD echo 'this command is specified by the user'
MAGIC_WORD

Everything within the MAGIC_WORD declarations would not have command
substitution, variable expansion, etc, but would be treated as if it were
wrapped in single quotes with the exception that single quotes between the
MAGIC_WORDs need not be escaped.

Pardon my naïveté, does any such feature exist or are there good ways to
accomplish this? If not, is this something that could feasibly be
implemented? Would it be desirable?

Thanks,

Patrick

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


Thread

Feature Request: Custom delimeter for single quotes Patrick Blesi <patrick@ble.si> - 2019-10-31 23:54 -0500

csiph-web