Bug 10931 - String searching
Summary: String searching
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-09 08:52 UTC by Ale
Modified: 2018-04-09 11:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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