bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature Request: Custom delimeter for single quotes


From: L A Walsh
Subject: Re: Feature Request: Custom delimeter for single quotes
Date: Sat, 02 Nov 2019 23:08:57 -0700
User-agent: Thunderbird

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]