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:
#!/bin/bash
for ((i=1;i<=10;i+=1));do
echo "mv 123 to 456 the $i \n"
time mv 123 456;
echo "mv 456 to 123 the $i \n"
time mv 456 123;
done
I named it "test"
leiyang@leiyang-laptop:~$ ./test
mv 123 to 456 the 1 \n
real 0m0.005s
user 0m0.004s
sys 0m0.000s
mv 456 to 123 the 1 \n
real 0m0.004s
user 0m0.000s
sys 0m0.004s
mv 123 to 456 the 2 \n
real 0m0.004s
user 0m0.000s
sys 0m0.004s
mv 456 to 123 the 2 \n
real 0m0.004s
user 0m0.000s
sys 0m0.004s
mv 123 to 456 the 3 \n
real 0m0.008s
user 0m0.000s
sys 0m0.004s
mv 456 to 123 the 3 \n
real 0m0.005s
user 0m0.000s
sys 0m0.008s
mv 123 to 456 the 4 \n
real 0m0.004s
user 0m0.000s
sys 0m0.004s
mv 456 to 123 the 4 \n
real 0m0.002s
user 0m0.000s
sys 0m0.004s
mv 123 to 456 the 5 \n
real 0m0.002s
user 0m0.000s
sys 0m0.000s
mv 456 to 123 the 5 \n
real 0m0.002s
user 0m0.000s
sys 0m0.000s
for example :
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