I need to compile all of the C files in a directory into seperate outputs... see example gcc -Wall program1.c -o program1.out
How do I do this?
Answer
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.
No comments:
Post a Comment