For the people who execute an interactive commands like fdisk and it needs alot of user input, and you want to script it. Check this out. Below script is just an example, bit you can think of better ways to use this concept just as kickstart files.
The script will create new primary partition and change the filesystem tag to 83 which represents ext3 , it will save the new partition, and updates partition map
#!/bin/bash cat <<EOF | fdisk /dev/sda n p 1 t 83 w EOF partprobe