19,612
社区成员
发帖
与我相关
我的任务
分享
#!/bin/sh
# This script is used to generate a file only contains 0xFF.
# And its size is 8192.
n=81920
while [ $n -ne 0 ];
do
echo -e '\0377\c' >> FF.bin
((n=n-1))
done
后来搜索网络,发现水木的帖子:
http://www.newsmth.net/nForum/#!article/LinuxApp/857984
里面各路牛人贡献了至少四种方法,我服了!
dd if=/dev/zero bs=1 count=200 | sed 's/\x00/\xff/g'
tr '\000' '\377' < /dev/zero | dd of=file bs=1024 count=2k
awk 'BEGIN {for (i=0; i<20480; i++) {printf "%c", 255}}' > $@.tmp
printf '%*s' 2048 ' ' | tr ' ' '\377'