2013年9月6日星期五

The dd command can generate a file containing 0xFF what ?

General usage is dd if = / dev / zero of = file_name bs = 1024 count = 1024, so you can get a "00 " Fill the paper , if you want to use "FF" filling, there is no direct approach ?
------ Solution ---------------------------------------- ----
n = 1000
while [$ n-ne 0]
do
echo-e '\ 0377 \ c' >> file_name
((n = n-1))
done
------ Solution ----------------------------------- ---------

+1
------ Solution ---------------------- ----------------------

applause
------ For reference only -------- -------------------------------

dawned , 0377 is the octal 0xFF, strace discovery is so output , has not react.
------ For reference only -------------------------------------- -
above method if you generate a K on M, 0xff file is too slow. You can use the following method :
<2> Full 0xff files generated 2M
tr '\ 000' '\ 377'

没有评论:

发表评论