thzhr2009 发表于 2010-01-12 18:33

fdisk的分区脚本问题

改的别人的脚本,将一500G硬盘分成一个分区,如下:
#!/bin/sh

disk=’/dev/scsi/host0/bus0/target0/lun0/disc’

echo -e "fdisk \\033[1;32m$disk\\033[0;39m now..."
dd if=/dev/zero of=/dev/scsi/host0/bus0/target0/lun0/disc bs=1 count=64 seek=446 &>/dev/null
fdisk $disk &>/dev/null <<EOF
n
p
1
\r
\r

w
EOF
echo -e "\\033[1;34mDone\\033[0;39m"
错误信息:
fdisk ’/dev/scsi/host0/bus0/target0/lun0/disc’ now...
Unable to open ’/dev/scsi/host0/bus0/target0/lun0/disc’
Done
~ $ 64+0 records in
64+0 records out
请问问题出在哪?
中间那段:fdisk \\033[1;32m$disk\\033[0;39m now中的数字代表什么?

[ 本帖最后由 thzhr2009 于 2010-1-12 19:43 编辑 ]

binglong168 发表于 2010-03-23 11:52

\\033[1;32m$disk\\033[0;39m    这个其实只是输出 $disk的内容,其他的字符都是格式控制的,跟具体的内容没有关系的

Moerae 发表于 2010-03-23 12:22

ls -l /dev/scsi/host0/bus0/target0/lun0/disc

file/dev/scsi/host0/bus0/target0/lun0/disc
页: [1]
查看完整版本: fdisk的分区脚本问题