help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] pass command to script


From: Chet Ramey
Subject: Re: [Help-bash] pass command to script
Date: Fri, 26 Apr 2019 18:28:27 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 4/26/19 4:14 PM, Christof Warlich wrote:
> Am 26.04.19 um 21:13 schrieb Chet Ramey:
> 
>> That's not correct. If you want to use the chosen close quote character
>> in an enclosed command, you have to have a way to quote it. For
>> completeness, you'd need a way to quote the opening sequence. Once you
>> have that, you need semantics to remove the quotes, and you're back to
>> semantic sugar that's little different from $'...'.
> 
> I'm not sure what you were about to say, my best quess is replacing
> some of your "quote"s with "_escape_"s:

In this context, they're identical. An escape character is simply a form of
quoting that acts on a single character.

> 
>> That's not correct. If you want to use the chosen close quote character
>> in an enclosed command, you have to have a way to _escape_ it. For
>> completeness, you'd need a way to _also_ _escape_ the opening
> sequence. Once you
>> have that, you need semantics to remove the _escapes_, and you're back to
>> semantic sugar that's little different from $'...'.
> 
> But still I don't see why you think that escaping would still be necessary!?

If you don't allow a mechanism to quote (or escape) your new open and close
quote characters, you eliminate them from use by a command. That's a show-
stopper.

> Imo, the only reason why escaping _is_ necessary _now_ is that it allows
> keeping
> track of the current nesting depth. But with any type of
> distinghuishable opening
> and closing quote characters, the nesting level would always be evident
> right
> away by just incrementing the nesting depth on any opening quote and
> decrementing
> it on any closing quote.

Nonsense. Let's take your original proposal of using $[ and ] to delimit
quoted characters. If you don't have a way to escape `]' in the enclosed
characters, you have just disallowed the user from using it. That takes
test/[ and `[[' out of the picture for use in the quoted command. If you
use $< and > you take redirection off the table, and so on. That's not
workable.


> Please also have a quick look at what I replied to Greg, I again did put
> quite some
> effort into that post to illustrate the gist of my idea.

I know you did. I just don't think you're considering all of the effects of
your proposal.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/



reply via email to

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