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


Groups > gnu.bash.bug > #15560

Re: Feature Request: Custom delimeter for single quotes

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From L A Walsh <bash@tlinx.org>
Newsgroups gnu.bash.bug
Subject Re: Feature Request: Custom delimeter for single quotes
Date Sat, 02 Nov 2019 23:08:57 -0700
Lines 27
Approved bug-bash@gnu.org
Message-ID <mailman.487.1572761402.13325.bug-bash@gnu.org> (permalink)
References <CAOnw=2J6fse6U=6zofMW7pORp0yTere_DYYSKGS6hf5xK2PuQA@mail.gmail.com> <5DBE6EF9.2000309@tlinx.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1572761403 24473 209.51.188.17 (3 Nov 2019 06:10:03 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org
To Patrick Blesi <patrick@ble.si>
Envelope-to bug-bash@gnu.org
User-Agent Thunderbird
In-Reply-To <CAOnw=2J6fse6U=6zofMW7pORp0yTere_DYYSKGS6hf5xK2PuQA@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy]
X-Received-From 173.164.175.65
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 <5DBE6EF9.2000309@tlinx.org>
X-Mailman-Original-References <CAOnw=2J6fse6U=6zofMW7pORp0yTere_DYYSKGS6hf5xK2PuQA@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15560

Show key headers only | View raw


On 2019/10/31 21:54, Patrick Blesi wrote:
> 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.
>   

I can't say for certain, but is there any reason why this wouldn't
work?  As long as the user input doesn't match the generated uuid,
it should be hard to match it as a delimiter...

I am probably missing something obvious, but this would seem to
solve your problem, no?



read usercmd       # or whatever/however you get the command

delim=$(uuidgen)
printf -v cmd "sh -c <<'%s'\n%s\n%s\n" "$delim" "$usercmd" "$delim"
eval $cmd

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


Thread

Re: Feature Request: Custom delimeter for single quotes L A Walsh <bash@tlinx.org> - 2019-11-02 23:08 -0700

csiph-web