當我執行bash腳本(**。/ partion.sh:line 11:$'n \ np \ n1 \ n \ nw \ n':command沒有找到 **):在分區磁盤的bash腳本中出現錯誤
./partion.sh: line 11: $'n\np\n1\n\nw\n': command not found
Checking that no-one is using this disk right now ... OK
Disk /dev/sdd: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disklabel type: dos
Disk identifier: 0x0ca4ca9d
Old situation:
>>>
New situation:
下面是腳本:
#!/bin/bash
hdd="/dev/sdd"
for i in $hdd;do
echo
"n
p
1
w
"|sfdisk $i;done
我還是個新手,所以真的很感謝所有幫助我能=)
那些是什麼命令''N''p''1' w'?你到底想要達到什麼目標?你想打印這些信件嗎? –
[本文](http://xmodulo.com/how-to-run-fdisk-in-non-interactive-batch-mode.html)顯示瞭如何以非交互方式使用'sfdisk'。這可能是一個更好的方法來完成這件事。 –
@VikasTiwari用於分區磁盤的命令 – Niknak