Bug 10931

Summary: String searching
Product: Busybox Reporter: Ale <ale5000>
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: normal CC: ale5000, busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Ale 2018-04-09 08:52:06 UTC
Hi,
it would be nice to support this syntax for string searching:

aaa='My string'
if [[ "$aaa" == *"stri"* ]]; then echo "It's there!"; fi
if [[ "$aaa" =~ .*stri.* ]]; then echo "It's there!"; fi
Comment 1 Denys Vlasenko 2018-04-09 11:22:03 UTC
[[ ]] is a bashism.

You can keep your scripts standard by using:

aa='My string'; if [ "${aaa##*stri*}" = "" ]; then echo "It's there!"; fi