The error message says it all. However, as a help to such problems in the future, you can adopt some practices:
- Comment out the line that is throwing up an error like so:
recent_files=($(ls -t | head -20))
recent_files=($(ls -t | head -20))
and run
bash -n myScript.sh
bash -n myScript.sh
This will check errors in the script.
- Comment out a block of lines like so:
Comment out a block of lines like so:
: << 'EOF' lines of code EOF
: << 'EOF'
lines
of
code
EOF
and run
bash -n myScript.sh
bash -n myScript.sh
Using this methodology, you will be able to zoom in on the erroneous line in your script.
Coming back to your specific problem, many have already answered what is causing it - the spaces around the == sign.