bug-bash
[Top][All Lists]
Advanced

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

Re: regex string ">(...)" in [[ ]] command recognize as process substitu


From: Chet Ramey
Subject: Re: regex string ">(...)" in [[ ]] command recognize as process substitution
Date: Mon, 31 Oct 2022 15:18:52 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.0

On 10/31/22 1:31 AM, Hyunho Cho wrote:

# this is an error
# [[ ]] command recognizes ">(.*)" as process substitution.
bash$ [[ $val =~ ((.*)<[^>]*>(.*)) ]] && echo yes      # Error !
bash$ .*: command not found

Yes, process substitution is one of the word expansions the pattern
undergoes (all words between [[ and ]] undergo the same set of word
expansions).

################  The Second problem  #################

This only happens in the terminal.

# 1. intentionally makes an error by removing escape "\>" to ">"
bash$ [[ $val =~ (.*)\ \<[^\>]*>\ (.*) ]] && echo yes
bash: syntax error in conditional expression: unexpected token `>'

# 2. fixed the error with \> escape, but the error continues
bash$ [[ $val =~ (.*)\ \<[^\>]*\>\ (.*) ]] && echo yes
bash: syntax error near unexpected token `$val'

This has already been fixed, the result of

https://savannah.gnu.org/support/index.php?110745



# 3. On the second try, the error goes away.
bash$ [[ $val =~ (.*)\ \<[^\>]*\>\ (.*) ]] && echo yes
yes

################  The third problem  #################

This also happens only in the terminal.
but very unexpectedly happens

I can't reproduce this using bash-5.2.2.

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




reply via email to

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