Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

the following test syntax is part of ksh script

   [[ $PARAM = TRUE ]] &&  [[ ` echo $LINE_FROM_FILE | grep -c Validation ` -eq 1 ]] && print "find Validation word"

Can I get some other creative syntax/solution/command to verify if Validation word exists in LINE_FROM_FILE without to use the echo command?

LINE_FROM_FILE="123 Validation V125 tcp IP="


share|improve this question
up vote 0 down vote accepted
... && [[ $LINE_FROM_FILE == *Validation* ]] && ...
share|improve this answer
not good because if I have Validatio and not Validation its also match , did you have other solution – lidia Aug 25 '10 at 10:30
Are you sure that this is with ksh then? == should do glob matching, and =~ does regex matching. – Ignacio Vazquez-Abrams Aug 25 '10 at 10:37
try with LINE_FROM_FILE="1 2 3 ValidationWORD" its also match – lidia Aug 25 '10 at 10:58
But that would match with your original command as well. – Ignacio Vazquez-Abrams Aug 25 '10 at 12:07

if the word separator in the "line from file" is always one or multiple spaces, try this:

if [[ " $LINE_FROM_FILE " == *" Validation "* ]] 

do'nt forget the quotes

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.