[Top][All Lists]

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

Re: Feature Request: Custom delimeter for single quotes

From: Eli Schwartz
Subject: Re: Feature Request: Custom delimeter for single quotes
Date: Sun, 3 Nov 2019 01:31:50 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0

On 11/3/19 1:08 AM, L A Walsh wrote:
> 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

Leaving aside all the many many MANY problems with what you jokingly
call "shellscripts"... once you have a usercmd variable, why do you need
to printf it into another variable in order to run it (in your existing
shell) via sh -c *AND* eval, with the end result of... evaluating
usercmd, no more, no less?

At any rate, your proposal is simply a syntax error, for two reasons:
- sh -c expects a string, not a stdin redirection
- eval must take a quoted variable in order to correctly handle
  variables with embedded newlines

Given many fine answers were already suggested in this thread, can we
avoid proposing new ones which are both terrible and terrible failures
at even being cursorily tested?

Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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