helpThe GNU Bourne-Again SHell - Support: sr #108110, [bug] righthand of = or == in [[...

 
 

sr #108110: [bug] righthand of = or == in [[ ]] seems to do quote removal on expanded variables

Submitted by:  Michal Soltys <msoltyspl>
Submitted on:  Fri 17 Aug 2012 11:40:52 PM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 24 Aug 2012 10:26:33 AM UTC, comment #1:

One correction: for == operator the behavior is fine (righthand is treated as a pattern and in such case backslash is removed), but for = it's still invalid.

Michal Soltys <msoltyspl>
Fri 17 Aug 2012 11:40:52 PM UTC, original submission:

Essentially, if someone does:

set -x
a='test\test'
[[ $a = $a ]]

Then the result (as of 4.2.37) will be false (even though debug output shows expected evaluation). The only way to get true is to quote righthand $a (or both). If I'm not missing any subtlety - I think it's not how it should be - as it looks like quote removal is sneaking in at some point modifying effects of earlier expansions.

Michal Soltys <msoltyspl>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by msoltyspl (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup