count=$(ls [0-9]*|wc -l) # Count filenames starting with a number found=$(grep -c 'para201' [0-9]*|grep -c '1$') # Count how many of them contain 'para201' echo $(($found==$count?0:1)) # Return 0 if the two are the same, 1 otherwise