‘dd’ command cannot support calculation for its parameters

$ dd if=/dev/zero of=./4Ktest100M bs=4KB count=25000*9
dd: invalid number `25000*9'

I think ‘dd’ should support calculation for its parameters like ‘bs’, ‘count’ and so on.

Answered by harryxiyou.

You can get the effect by using some other tools/commands, like

dd if=/dev/zero of=./4Ktest100M bs=4KB count=$((25000*9))

or

dd if=/dev/zero of=./4Ktest100M bs=4KB count=$(bc <<< 25000*9)

I think it makes sense. Thank you.

Weiwei Jia

Weiwei Jia is a Ph.D. student in the Department of Computer Science at New Jersey Institute of Technology since 2016. His research interests are include storage systems, operating systems and computer systems.

Leave a Reply

Your email address will not be published. Required fields are marked *