Hello Miguel, can you give a concrete example to demonstrate the issue?

The bash(1) manpage and the wolledge bash wiki give me the strong
impression that the variable containing the regex should *not* be
quoted:

http://mywiki.wooledge.org/BashPitfalls#if_.5B.5B_.24foo_.3D.2BAH4_.27some_RE.27_.5D.5D

The quotes around the right-hand side of the =~ operator cause it to
become a string, rather than a RegularExpression. If you want to use a
long or complicated regular expression and avoid lots of backslash
escaping, put it in a variable:

re='some RE'
if [[ $foo =~ $re ]]

This also works around the difference in how =~ works across different
versions of bash. Using a variable avoids some nasty and subtle
problems.


http://manpages.ubuntu.com/manpages/focal/man1/bash.1.html

       brackets.  If the pattern is stored in a shell variable,
       quoting the variable expansion forces the entire pattern to
       be matched as a string.  Substrings matched by parenthesized


Thanks

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1922459

Title:
  restricted-ssh-commands regex check is not properly escaped

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/restricted-ssh-commands/+bug/1922459/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to