Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
share|improve this answer

Your Answer


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.