`rm $file` fails with `rm: cannot remove 'monthly': No such file or directory` and `rm: cannot remove 'report.csv'`.
BeginnerTroubleshootingTroubleshooting: quoting, expansion and tool-input bugs
Answer
Likely causes → file="monthly report.csv" was word-split into two arguments because it was not quoted. A name with * would be worse: it would expand to other files.
Diagnose → printf '[%s]\n' $file shows the split.
Fix → rm -- "$file".
Prevent → Quote every expansion; test scripts with filenames containing spaces, quotes and leading dashes.
More on Troubleshooting: quoting, expansion and tool-input bugs
`bash: [: too many arguments`Beginner`bash: [: =: unary operator expected`BeginnerA disk check fails with `[: 93%: integer expression expected`BeginnerA cleanup script logs `cp: cannot stat '/var/log/app/*.log': No such file or directory` on quiet days.Beginner`echo "start" > $logfile` fails with `bash: $logfile: ambiguous redirect`Intermediate`hosts[${#hosts[@]}-1]` style code fails with `bash: hosts: bad array subscript`.Intermediate