Welcome to the Linux Foundation Forum!

syntax error near unexpected toke 'fi'

Daeron Posts: 1
edited April 2018 in Command Line/Scripting

if [ $(find . /root | wc -l) -eq $(find . /media |wc -l) ] >> /root/datos.txt then echo "Copy was made succesfully" >> /root/datos.txt elif [ $(find . /root | wc -l) -ne $(find . /media |wc -l) ] echo "Copy wasn't made" >> /root/datos.txt fi

Hi everyone! I'm new at this forum and my native language it's not the english. Does someone know whats wrong with this script?

./script2: line 54: syntax error near unexpected token `fi'

./script2: line 54: `fi'


Thanks in advance!



  • I could say wrong but I think you need to close the first if conditions because Elif is another if the branch else.


Upcoming Training