Content deleted Content added
No edit summary |
No edit summary |
||
Line 64:
4.000000 10.000000
6.000000 12.000000
=== Shell programming ===
Find and compile all .c files into .o in the current directory when the .o is old or absent.
#!/bin/ch
#include <sys/stat.h>
struct stat cstat, ostat;
string_t c, o;
foreach (c; `find . -name "*.c"`)
{
o=`echo $c | sed 's/.c$/.o/'`;
stat(o, &ostat); stat(c, &cstat);
if (ostat.st_mtime > cstat.st_mtime)
{
echo "compiling $c to $o";
gcc -c -o "$o" "$c";
}
}
|