You just need to walk through fdisk and jot down exactly which key presses are needed to do what you want. Once you do that then you just put them in the script like this:
#!/bin/bash
fdisk /dev/hdX <<EOF
d
3
d
2
d
1
n
p
1
16
p
q
EOF
Or you could put the keystrokes in a file and do it like this
fdisk /dev/dev/hdX <keystrokefile
Something like that should work.
|