1

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 )

yael
  • 2,433
  • 5
  • 31
  • 43

2 Answers2

2
$ echo $list | grep linux1a | grep linux1b

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

Guru
  • 254
  • 1
  • 2
0
if [[ " $list " = *" linux1a "* && " $list " = *" linux1b "* ]]; then 
  echo yes
fi 
glenn jackman
  • 4,630
  • 1
  • 17
  • 20