Run a command on every file in a directory, changing the output name

Solution 1:

Use string manipulation:

for f in *.c; do gcc -Wall "$f" -o "${f%%.c}.out"; done

No need for complicated regular expressions or anything that's not a shell builtin here.