Reputation: 2977
I have a long if clause in my Bash script that is giving me a warning of script.sh: line 1: [: too many arguments
Here is the if
clause:
if [ ! -f first_"$today".csv.gz ] || [ ! -f second_"$today".csv.gz ] || [ ! -f third_"$today".csv.gz ] || [ ! -f fourth_"$today".csv.gz ] || [ ! -f fifth_"$today".csv.gz ] || [ ! -f sixth_"$today".csv.gz ]\
[ ! -s first_"$today".csv.gz ] || [ ! -s second_"$today".csv.gz ] || [ ! -s third_"$today".csv.gz ] || [ ! -s fourth_"$today".csv.gz ] || [ ! -s fifth_"$today".csv.gz ] || [ ! -s sixth_"$today".csv.gz ];
So I worked backwards by commenting out each if bracket/statement from the end. When I ended up commenting out the entire second line and ending the if clause at the end of the first line, I stopped receiving the error/warning message. I have similar if statements elsewhere in my script, and they all run perfectly fine.
My script does not break at all, as it continues on with the rest of the script. I would like to fix this so that the warning message stops popping up. Is there something I'm doing wrong with the newline character? Anything else I missed?
Upvotes: 1
Views: 28