How to use for loop together with stat command in lix shell?

Solution 1:

Put a $ in front of the variable and enclose it in double quotes so that it also works for file names with spaces.

for file in *; do stat "$file"; done