[event]
is a shell pattern. When you expand $file$suffix
, your shell attempts to match any files in the current directory whose names match the value of $file
followed by e
, v
, n
, or t
. Quoting the expansion should speed things up, by avoiding the attempt to match the pattern. (Note that you would get very different output if there were any matching files.)
suffix=[event]
for i in {0..9} a b; do
for file in $(cat gsc"${i}".list); do
echo "$file$suffix"
done
done
As others have mentioned, the loop is better written
for i in {0..9} a b; do
while read file; do
echo "$file$suffix"
done < gsc"$i".list
done
or replaced altogether with tripleee's sed
command
sed "s|.*|mv '&' '&[event]'|" gsc[0-9ab].list | sh