An Long <lan@xxxxxxxx> writes: > + if [[ $str =~ ^[0-9]+[a-zA-Z]$ ]] ; then > + size=${str:: -1} > + endchar=${str: -1} > + case $endchar in > + e|E) > + mult=$((mult * 1024)) > + ;& > + p|P) > + mult=$((mult * 1024)) > + ;& > + t|T) > + mult=$((mult * 1024)) > + ;& > + g|G) > + mult=$((mult * 1024)) > + ;& > + m|M) > + mult=$((mult * 1024)) > + ;& > + k|K) > + mult=$((mult * 1024)) > + ;& > + b|B) > + ;; > + *) > + echo "unknown size descriptor $endchar" > + exit 1 > + esac > + elif [[ $str =~ ^[0-9]+$ ]] ; then > + size=$str > + else > + echo "size value $str is invalid" > + exit 1 > + fi > + > + size=$((size * mult)) > + echo $size > +} Hi An, Coreutils has numfmt(1) to do this kind of conversion. I wonder if we could use it here, unless it is not available all the platforms that matters for xfstests, though: $ echo 1K | numfmt --from=iec 1024 > + > # Create fs of certain size on scratch device > # _scratch_mkfs_sized <size in bytes> [optional blocksize] > _scratch_mkfs_sized() -- Gabriel Krisman Bertazi