Hi programmers, say I have 4 files : file1.py,file2.py,file3.py,file4.py
How do I, on a korn shell, create one file, run_all, that is one file that sequentially calls file1-file4, but only so if they complete w/o errors?
Something like:
#!/usr/bin/ksh
file1.py
/*......????*/
Anyone know how to call a bunch a files in one file, kind of like one .sas file with'a bunch of %INCLUDE statements to call other .sas programs (for any sas programmers out there).
If you've got a stack of them, you can always do this in a loop too of course:
# runs anything that starts with "file" and ends with .py in alpha order
for script in ./file*.py
do
if script
then
echo "$script OK"
else
echo "$script failed"
exit 1
fi
done
exit 0
I don't know what my problem is, but I tried all three above and no dice?
New to shells, but I basically have 4 files (1.py, 2.py, 3.py,
4.py). I created a new file foo in vi, typed all three types of code above and the go to the unix prompt and type foo [enter] no dice. Pyton foo, still no dice???
Doh! I bet yer right^ I prob forgot to set the permission to execute *blushing*
I just logged out of the ssh and rebooted the PC, will check in the am but bet yer prob right!
Love this place! You all are real patient and nice. Sorry for the basic questions! I've a python book on order from the library so, I should be less confused soon....(well maybe not )
Worked like a charm Alister, that is some seriously easy to understand code!
It was nice to make file2 have a bad ref in the infile and then see what happened. It stopped the process dead in the tracks and the KSH reported the error with file 2 (i.e. "....no such file or dir..." I fixed the ref and all's square again. Great code, easy to understand. Me and my team are new to unix. Gotta get my python book.