-1

I am trying to do a bash file that does the next:

From a folder, extract only the ones that have the clean word in their filenames.

From these ones, if one has a 1 in them, then take that one and the following.

Right now, I am in this point:

pwd

for filename in $(find . -name '*clean*' | sort); do
    if [$filename = '*1.clean*']; then
        echo expression evaluated as true
    fi

done

I am having problems with the if statement, because I am not really wure how to formulate it

Thanks

MLMH
  • 141
  • 8

1 Answers1

1

there must be spaces before ] and after [

a='txt'
if [ 'txt' = $a ]
then
    echo "yes"
fi

more about if statement: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html

Andrew
  • 958
  • 13
  • 25