On Sun, Sep 25, 2022 at 03:44:35AM +0700, Robert Elz wrote: > (in this message, \s represents a space, just for clarity - \s meaning space > cannot be used in shells, any of them, anywhere)
Just for the record, if \s appears in the regex on the right hand side of =~ in bash's [[ $string =~ $regex ]], it will be interpreted by the regex engine in the system's libraries, and may or may not have a special meaning. unicorn:~$ regex='x\sy' unicorn:~$ [[ 'x y z' =~ $regex ]] && echo match match unicorn:~$ cat /etc/debian_version 11.5 It's not special to bash, of course -- just to the underlying regex machinery on this platform (GNU libc). Therefore, it cannot be used in a script that's intended to be portable.