I have a bunch of 7-zip files under a directory and I would like to extract all of them and then delete successful ones in bash. I wrote this:
for f in *.7z; do if 7z e "$f" then echo "error $f" else rm "$f" fi; done
and bash prompts: -bash: syntax error near unexpected token
done'`. How to fix this statement?