Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search string

Status
Not open for further replies.

SOL9MAN

Technical User
Mar 11, 2003
12
0
0
GB
IF I had a UNIX Variable defined as the following.

typeset var1="ABCDE\1FGHIJ"

I need to test whether var1 variable has the substring "\1" within the whole string.

Has anybody got an idea of how I test for a substring within the string.

thanks & regards
 
if [[ $var1 = *\1* ]]
then
echo true
fi
 
Code:
case $var1 in
*\\1*) echo found;;
*) echo not found;;
esac

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top