Try
I=`wc -c "$i"` # always use quoted var J=`wc -c "$j"` [[ "$I" == "$J" ]] && echo "$i" "$j" >> "$1".pares
Always specify variables, because you can have a file name containing a space.
Despite the fact that BASH is case insensitive with variable names, it is better and safer to use a different (and longer than one char) name for the variables.
source share