Error while executing bash script -


i have file named 1.txt contains numbers, 2, 30,20,1 etc. trying compare each number in text file numeric value 20 , run command if value equal 20, otherwise exit.

my code given below. when try run bash script, getting error

---------- email.sh: line 2: [[2: command not found email.sh: line 2: [[1: command not found 

for f in $( cat 1.txt );    if [[$f -eq "20"]];          echo "sucess"    fi done 

you should have space after [[ in if

 if [[ "$f" -eq "20" ]]; 

example

$ if [[ "$f" -eq "20" ]];          echo "sucess";    fi sucess 

why?

in bash [[ ]] construct called extended test command, , need separate tokens in language spaces.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -