initial commit
This commit is contained in:
17
chapter2/function_elapsed_time
Executable file
17
chapter2/function_elapsed_time
Executable file
@@ -0,0 +1,17 @@
|
||||
elasped_time ()
|
||||
{
|
||||
# This elapsed_time function is for Bash shell
|
||||
|
||||
SEC=$1
|
||||
|
||||
(( SEC < 60 )) && echo -e "[Elasped time: \
|
||||
$SEC seconds]\c"
|
||||
|
||||
(( SEC >= 60 && SEC < 3600 )) && echo -e \
|
||||
"[Elasped time: $(( SEC / 60 )) min $(( SEC % 60 )) sec]\c"
|
||||
|
||||
(( SEC > 3600 )) && echo -e "[Elasped time: \
|
||||
$(( SEC / 3600 )) hr $(( (SEC % 3600) / 60 )) min \
|
||||
$(( (SEC % 3600) % 60 )) sec]\c"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user