日期:2014-05-16 浏览次数:20668 次
[freebsd:~/shcode ]$cat temp.txt filename=system.img filename=yaffs2_gnu_system.img size=734003200 size=471859200 filename=flashboot.img [freebsd:~/shcode ]$cat sh901.sh cfgfile=temp.txt rootfs_size=11111 cat ${cfgfile} | sed -e /filename=system.img/d -e /filename=yaffs2_gnu_system.img/d -e s/size=734003200/size=${rootfs_size}/ -e s/size=471859200/size=${rootfs_size}/ -e s/filename=flashboot.img/filename=boot.img/ > flash.cfG [freebsd:~/shcode ]$chmod u+x sh901.sh [freebsd:~/shcode ]$./sh901.sh [freebsd:~/shcode ]$ls flash.cfG sh900.sh sh901.sh temp.sh temp.txt [freebsd:~/shcode ]$cat flash.cfG size=11111 size=11111 filename=boot.img
------解决方案--------------------
自己新建个文件试一下就知道了:
[freebsd:~/shcode ]$cat temp.txt filename=system.img aa filename=yaffs2_gnu_system.img aa size=734003200 size=471859200 filename=flashboot.img aa [freebsd:~/shcode ]$cat sh901.sh cfgfile=temp.txt rootfs_size=11111 cat ${cfgfile} | sed -e /filename=system.img/d -e /filename=yaffs2_gnu_system.img/d -e s/size=734003200/size=${rootfs_size}/ -e s/size=471859200/size=${rootfs_size}/ -e s/filename=flashboot.img/filename=boot.img/ > flash.cfG [freebsd:~/shcode ]$./sh901.sh [freebsd:~/shcode ]$cat flash.cfG size=11111 size=11111 filename=boot.img aa