shell code help please
Hey,
2 questions regarding the shell. 1 - In a shell script i want several apps to run successively. ram1.pl, ram2.pl, ram3.pl etc. I've tried "./ram*" but that just ran the first script and stopped. Is there a way i can run these without typing them all out in the script? 2 - i want to get the output of 'time perl.pl' into a file. i tried 'time perl.pl > time.txt' but that didn't work. I tried echo `time perl.pl` > time.txt which also failed. I assume there is a way. Any help please? Thanks |
1)
for i in ram* do $i done 2) the first way will work, unless it is being written to stderr instead of stdout. does changing > to 2> make a difference? If so, the code needs to be changed to use stdout properly. |
Quote:
Code:
for fn in *.pl Code:
for fn in *.pl Code:
/usr/bin/time -o time.txt ./perl.pl Code:
$ man time |
Thanks guys. Very helpful.
|
Quote:
try ./ram* & that should work (i think!) linux |
Run the code
while ((flag != 1)) do ram1.pl & pid1=(ps -ef | grep ram1.pl | grep -v "grep") ram2.pl & pid2=(ps -ef | grep ram2.pl | grep -v "grep") ram3.pl & pid3=(ps -ef | grep ram3.pl | grep -v "grep") ram4.pl & pid4=(ps -ef | grep ram4.pl | grep -v "grep") if [[ -z "$pid1" && -z "$pid2" && -z "$pid3" && -z "$pid4" ]];then flag=1 fi done |
All times are GMT -5. The time now is 08:04 AM. |