How to write a script in Linux

來源: 2004-12-09 11:11:20 [舊帖] [給我悄悄話] 本文已被閱讀:

//test.cpp
/*
int main()
{
string file1, file2, outfile;
cout cin>>file1>>file2;
cout cin>>outfile;

return 0;
}
*/

//filename1.txt
test1a.txt test1b.txt
out1.txt

//filename2.txt
test2a.txt test2b.txt
out2.txt

//filename3.txt
test3a.txt test3b.txt
out3.txt


//script
g++ test.cpp
./a.out g++ test.cpp
./a.out g++ test.cpp
./a.out

SO in linux, I just need run the script.
But I have lots of files to test, is that possible if I put all test filenames in one .txt file? such as

//filename.txt
test1a.txt test1b.txt
out1.txt
test2a.txt test2b.txt
out2.txt
test3a.txt test3b.txt
out3.txt


and how to write the script? (need a loop inside the script?)
Anyone has an idea ?
Thank you