How can I run fdisk partition in a script without interactive input?
In manual procedure, I run fdisk device, select n, select p, presess enter for default start number (1), press enter to default end number, then select w for writing to the partition table. The command looks like "fdisk -u -p ..... /dev/device"
I personally would not run commands like fdisk that way, at the risk of screwing up a disk.
It is your disk, so:
in UNIX you create a script using a here document:
fdisk -u -p /dev/whatever <<EOF
n
p
1
w
EOF
EOF can be any word that the shell does not interpret as a command. You can even use a ! I picked EOF as a lot people use it... That last EOF has to be in column 1.