[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Built-in method for searching variable strings

From: Chet Ramey
Subject: Re: [Help-bash] Built-in method for searching variable strings
Date: Sat, 01 Nov 2014 17:39:48 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/1/14 11:34 AM, asem nofal wrote:
> Hello guys, i have searched for a built-in method for searching variables
> for sub strings but i have not found any built-in support for that , so i
> think that you should take that in consideration in the later release,
> since it's very common and vital process


case $foo in
*"$sub"*)       echo found substring ;;
*)      echo didn\'t ;;

if [[ $foo == *"${sub}"* ]]; then
        echo found substring
        echo didn\'t

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]