#til

See tagged statuses in the local bookrastinating.com community

that bash's regex syntax gets confused sometimes, so it's best to do something like this:

~ $ size="1024 768"
~ $ [[ $size =~ ^[0-9]+ [0-9]+$ ]]
bash: syntax error in conditional expression
~ $ regex="^[0-9]+ [0-9]+$"
~ $ [[ $size =~ $regex ]]; echo $?
bash: syntax error near unexpected token `$size'
~ $ [[ $size =~ $regex ]]; echo $?
0
~ $

Umm... that second syntax error, I cannot account for.

@mirabilos, any idea what bash is smoking here???