lkml.org 
[lkml]   [2023]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH blktests v3 01/12] nvme/rc: Auto convert test device size info
Date
On May 03, 2023 / 10:02, Daniel Wagner wrote:
[...]
> +convert_to_mb()
> +{
> + local str=$1
> + local res
> +
> + res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)$/\1/p')
> + if [[ -n "${res}" ]]; then
> + echo "$((res / 1024 / 1024))"
> + fi
> +
> + res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)[mM]$/\1/p')
> + if [[ -n "${res}" ]]; then
> + echo "$((res))"
> + fi
> +
> + res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)[gG]$/\1/p')
> + if [[ -n "${res}" ]]; then
> + echo "$((res * 1024))"

Here are some spaces still left.

> + fi
> +}
\
 
 \ /
  Last update: 2023-05-08 00:50    [W:0.225 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site