mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Added x-hack to expr example for safety
@@ -13,7 +13,8 @@ fi
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
if expr "$var" : '.*foo[0-9]\{1,\}' >/dev/null; then
|
# Use the x-hack to handle strings like '('.
|
||||||
|
if expr "X$var" : 'X.*foo[0-9]\{1,\}' >/dev/null; then
|
||||||
echo matched
|
echo matched
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user