![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to set guest static IP | satimis | Ubuntu | 3 | 08-02-2008 10:27 PM |
| Static Route | Arun.Kakarla | UNIX for Dummies Questions & Answers | 2 | 07-17-2008 08:07 AM |
| static route ? | chaandana | IP Networking | 3 | 07-05-2005 02:05 AM |
| Static | wojtyla | High Level Programming | 6 | 02-25-2005 11:57 AM |
| Static IP | IP Networking | 7 | 05-18-2003 07:33 PM | |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
How to static the average value
Hi all,
Sorry I make a mistake,the title should be "How to statistic the average value " I do five times about "mv 123 to 456" and do five times about "mv 456 to 123" As we know,"time" can get the real usr sys value, I want to get the average real,usr,sys of "mv 123 to 456" and "mv 456 to 123" Quote:
for "mv 123 to 456" I want to got real_average_123_to_456=(real+real+real+real+real)/5 (here real is for "mv 123 to 456'' in each time),also want to get usr_average_123_to_456,sys_average_123_to_456 for "mv 456 to 123" I want to got real_average_456_to_123=(real+real+real+real+real)/5 (here real is for "mv 456 to 123'' in each time),also want to get usr_average_456_to_123,sys_average_456_to_123 how can I modify above code.I'm poor in bash shell.please show me a light Last edited by yanglei_fage; 04-22-2009 at 12:54 PM.. |
|
||||
|
bash does not do floating point math by itself. Since you have to convert the output of time into something you can do math on, this whole thing scream "use perl" to me.
As a hint, though, look at your man page for time. On Linux you can do "time -p" and it will output in a decimal value instead of tacking on the minute and second units. |
|
||||
|
But apparently ksh does:
Code:
colemar@deb:~$ echo $((1.0/7)) bash: 1.0/7: syntax error: invalid arithmetic operator (error token is ".0/7") colemar@deb:~$ ksh $ echo $((1.0/7)) 0.142857142857142857 |
|
||||
|
Thanks for the reply, If we use ksh, How can we got the answer.
Anyone can post the code? |
| Sponsored Links | ||
|
|