Quantcast
Channel: Parse SLURM job wall time to bash variables - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by ThatsRightJack for Parse SLURM job wall time to bash variables

$
0
0

The solution presented by @Andrew Vickers above works as expected. However, I took this one step further to enforce a fixed 2 digit format

index=0
while [ ${index} -lt 4 ]; do
    if [ ${#parts[${index}]} -lt 2 ]; then
        parts[${index}]="0${parts[${index}]}"
    fi
((index++))
done

The conditional check could be incorporated into his answer, but his loop would need to be adjusted to format all variables.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images