Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

how to match the words linux1a and linux1b from single line ? ( should be performed by ksh )

       list="solaris1a Auto global linux1a linux1b"


       echo $list | .... ?

my target is to find that linux1a and linux1b are exists in the line { $list )

share|improve this question

2 Answers 2

up vote 2 down vote accepted
$ echo $list | grep linux1a | grep linux1b

If after both the grep's you still get the output, then it exists.

share|improve this answer
if [[ " $list " = *" linux1a "* && " $list " = *" linux1b "* ]]; then 
  echo yes
fi 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.