Shell Script average runtime

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Shell Script average runtime
# 8  
Old 10-12-2011
Leave off the | bc and see what you're actually feeding into bc. If your script prints anything, you'll have to redirect that to /dev/null so that it doesn't get fed into bc.
# 9  
Old 10-12-2011
shit got messy without the | bc ... x)

Code:
~/oblig1$ bash oblig2.sh
(
( ( /home/oblig1/oblig1a * 60) * sh ) +
( ( --2011-10-12 20 * 60) * 03 ) +
( ( Løser osyda50 * 60) * hive ) +
( ( Ansluter till osyda50 * 60) * hive ) +
( ( HTTP foresprrsel sendt, mottar topptekster * 60) *  ) +
( ( Återanvänder befintlig anslutning till osyda50 * 60) * hive ) +
( ( HTTP foresprrsel sendt, mottar topptekster * 60) *  ) +
( ( Lengde * 60) *  20732 (20K) [text/html] ) +
( ( Sparar till "01 * 60) * html" ) +
( (  * 60) *  ) +
( (      0K  * 60) *  ) +
( (  * 60) *  ) +
( ( 2011-10-12 20 * 60) * 03 ) +
( (  * 60) *  ) +
( ( --2011-10-12 20 * 60) * 03 ) +
( ( Løser osyda50 * 60) * hive ) +
( ( Ansluter till osyda50 * 60) * hive ) +
( ( HTTP foresprrsel sendt, mottar topptekster * 60) *  ) +
( ( Återanvänder befintlig anslutning till osyda50 * 60) * hive ) +
( ( HTTP foresprrsel sendt, mottar topptekster * 60) *  ) +
( ( Lengde * 60) *  36367 (36K) [text/html] ) +
( ( Sparar till "02 * 60) * html" ) +
( (  * 60) *  ) +
( (      0K  * 60) *  ) +
( (  * 60) *  ) +
( ( 2011-10-12 20 * 60) * 03 ) +
( (  * 60) *  ) +
( ( --2011-10-12 20 * 60) * 03 ) +
( ( Løser osyda50 * 60) * hive ) +
( ( Ansluter till osyda50 * 60) * hive ) +
( ( HTTP foresprrsel sendt, mottar topptekster * 60) *  ) +
( ( Återanvänder befintlig anslutning till osyda50 * 60) * hive ) +
( ( HTTP foresprrsel sendt, mottar topptekster * 60) *  ) +
( ( Lengde * 60) *  14439 (14K) [text/html] ) +
( ( Sparar till "03 * 60) * html" ) +
( (  * 60) *  ) +

# 10  
Old 10-12-2011
Yeah; anything that prints to stdout in that loop gets sent to bc, that stuff included. You have to redirect your script to /dev/null with > /dev/null after the program.
This User Gave Thanks to Corona688 For This Post:
# 11  
Old 10-12-2011
Code:
~/oblig1$ bash oblig2.sh
(standard_in) 2: syntax error
(standard_in) 2: syntax error
(standard_in) 3: syntax error


Code:
/usr/bin/time -f "%E"  ~/oblig1/oblig1a.sh >/dev/null 2>&1

# 12  
Old 10-12-2011
Quote:
Originally Posted by Corona688
Leave off the | bc and see what you're actually feeding into bc.
Try reversing the order, 2>&1 > /dev/null
# 13  
Old 10-12-2011
Quote:
Originally Posted by Corona688
Try reversing the order, 2>&1 > /dev/null

that will bring me back to the loooong list of standard_in errors I had before. it pretty much puts me back where I was without >/dev/null by the looks of it when I remove | bc to check again.

it seems the problem is
Code:
:~/oblig1$ bash oblig2.sh
(
0 )
/ 100

# 14  
Old 10-12-2011
okay, apparently bc doesn't like newlines.

You're also not getting any of the output you wanted. Smilie You might have to make a version of your script which prints no output.

Instead of echo "stuff" do

printf " %s " "stuff" so you'll get one long output string separated by spaces instead of newlines.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to create runtime variables based on the number of parameters passed in the script

Hi All, I have a script which intends to create as many variables at runtime, as the number of parameters passed to it. The script needs to save these parameter values in the variables created and print them abc.sh ---------- export Numbr_Parms=$# export a=1 while do export... (3 Replies)
Discussion started by: dev.devil.1983
3 Replies

2. Shell Programming and Scripting

Shell or awk script to compute average of all the points within a circle

HI Help, I have a file which looks like below --- Input file ---> 1970113.00000 3460.00000 1.09516 1970116.00000 3791.00000 1.06350 1970120.00000 4120.00000 1.07588 1970115.00000 4450.00000 1.09591 1970116.00000 4780.00000 1.09965 1970120.00000 5109.00000 1.06733 ... (7 Replies)
Discussion started by: Indra2011
7 Replies

3. Shell Programming and Scripting

shell script for finding average runtime of other script

so I've made a shell script that downloads 6 files in succession from a given url, then deletes them. Now I want to time the script, and the average time it uses by running it ~100 times. My problem is tho, how do I store the time it takes for each run through of the script? I know time writes to... (3 Replies)
Discussion started by: navlelo
3 Replies

4. Shell Programming and Scripting

Shell Runtime Statistics

Hi, I am trying to capture runtime stats of a shell script (c shell). Are there system variables to call? Or should I create a date variable at the start of the script and at the end of the script? I am trying to capture the time if the script stops or ends with error. Please help. ... (4 Replies)
Discussion started by: CKT_newbie88
4 Replies

5. Shell Programming and Scripting

passing runtime arguments to a shell script...

hi I am new to shell programming.....my question is while running one of my shell program it stops in between to accept input from the user and proceeds furthur after giving input....I want to know whether I can set this input through some files so that the shell acript reads the input from the... (10 Replies)
Discussion started by: santy
10 Replies

6. UNIX for Advanced & Expert Users

Allocate memory for a shell script in Aix at runtime-urgent critical

How to allocate memory for a shell script on aix box at the time of execution i.e at runtime Are there any commands for AIX in specific Thanks in Advance (1 Reply)
Discussion started by: aixjadoo
1 Replies

7. UNIX for Dummies Questions & Answers

allocate memory for a shell script at runtime--urgent critical help!!!

How to allocate memory for a shell script on aix box at the time of execution i.e at runtime Are there any commands for AIX in specific Thanks in Advance (3 Replies)
Discussion started by: aixjadoo
3 Replies

8. AIX

allocate memory for shell script at runtime during execution--urgent critical help!!

How to allocate memory for a shell script on aix box at the time of execution i.e at runtime Are there any commands for AIX in specific Thanks in Advance (1 Reply)
Discussion started by: aixjadoo
1 Replies

9. Shell Programming and Scripting

pass runtime parm to at -f shell script

Hi Folks... I am using a ksh script to submit the at command to run a shell script for immediate execution. The shell script requries 1 parameter. Command in the script is at -m -f $EXE_DIR/process_server.sh $START_TIME $DB_NAME where START_TIME=now and DB_NAME= tnsname of Oracle... (1 Reply)
Discussion started by: island360
1 Replies

10. Shell Programming and Scripting

korn shell version at runtime?

How can I check what kornshell version I am using at runtime from within a kornshell script? (3 Replies)
Discussion started by: qanda
3 Replies
Login or Register to Ask a Question