At line 1 you have a space between the '=' and the 0, but there shouldn't be a spaces either before or after the '=' in an assignment.
At line 4 happens the same, but also you missed the backticks '`' around the commands, that indicate bash to evaluate what is inside the backticks and return the output of that command.
At line 5 it says:
$sum$(($sum+$e))
So did you mean:
sum=$(($sum+$e))
Update: I have found three problems more:
In line 2, replace /home
with /home/*
, because the former only uses /home in the loop, and the later returns every directory (and file) in the /home directory.
You are passing d" "
to cut
, the correct option is -d " "
.
Also, du
output is formatted with tabs, not spaces. If you delete the -d " "
in cut
, it works.