[Top][All Lists]

[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: Sun, 03 Nov 2019 01:15:34 -0700
User-agent: Thunderbird

On 2019/11/02 23:31, Eli Schwartz wrote:
> 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?  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".
Sorry, but reading your responses in this thread had me more than a bit

I just typed in something off the top of my head -- no aliases or
anything (OMG!), and directly into my email client as it was pushing
it to get it to 4 lines even using an "intermediate variable" passed
to eval.  That, on top of introducing a very-unlikely-duplicable,
randomly-generated, uuid-based 'delimiter', getting it to 4 lines
was tough!

I asked the _original poster_ if it would work for their use case,
not whether or not you approved or could break it.  I did say
I wasn't certain about the solution and that I was probably missing
something obvious. Certainly, there was no claim of it being

Reading your responses, first you tell him he's wrong for combining
languages and try to get him to change that.

Then you tell him his thinking is incorrect in wanting to use shell in
the first place, and bring in FUD for not writing a secure solution
in the first place (weren't they looking for _any_ solution to start
with?).  That was followed by more FUD with the specter of poor
performance (maybe on cygwin), ignoring basic SW development
priorities of _first_ getting to a working prototype.
I neglected to catch your submitted solution, BTW, only critique.

> ... once you have a usercmd variable, why do you need
> to printf it into another variable in order to run it ...
Oh, I dunno, but sometimes, I like to print things out before
I execute them, random stuff like that.  I tend to put things
in variables in between steps and leave optimization till later.

> Given many fine answers were already suggested in this thread
    Oh look, Patrick already came up with a similar answer -- and
you already judge it as 'fine', so I'll take that as a compliment
on mine as well, compared to your...oh, that's right, you didn't
propose an answer, you just criticized others.  I see that spot --
not putting stuff out there to avoid criticism, while showing off your
knowledge criticizing other people's work.  Nice safe way to feel good
about yourself while congratulating yourself on showing those other
know-nothings your stuff.

> , can we
> avoid proposing new ones which are both terrible and terrible failures
> at even being cursorily tested?
    You haven't proposed any yet, but thanks to your feedback, the poster
does have another working example to draw from.  You should try it sometime,
though warning, it is hard trying to please others, some people will go out
of their way to shoot others down...

Cheers and may the Schwartz be with you!

reply via email to

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