Simple things:
To assign a variable to an array:
0:16 is the substring position within the string
Converting seconds to HH:MM:SS
To assign a variable to an array:
array_config_timestamp[$i]="${array_config[$i]:0:16}"Breaking this down, $i = index
0:16 is the substring position within the string
(( i++ ))adds 1 to the variable i
max_updates=$(( $j-1 ))j =j-1
Converting seconds to HH:MM:SS
hours=$(( ${array_error_time[$i]} / 3600 ))
seconds=$(( ${array_error_time[$i]} % 3600 ))
minutes=$(( $seconds / 60 ))
seconds=$(( $seconds % 60 ))
So basically (( )) interprets the expression within, % is the basic arithmetic function mod
array_error_updatei[$error_index]=`/usr/bin/expr index "${array_index_name[$j]:10}" _`This searches for the first occurence of _ within the array array_index_name with index j from position 10
printf "%s %d\x68%d\x6d%d\x73" ${array_error[$i]:9} $hours $minutes $secondsprints formatted text ${array_error[$i]:9} and HH:MM:SS as 1h 2m 3s
No comments:
Post a Comment