If you wanted, you could do it like so:
echo -e "p\nq\n" | fdisk
However, it sure is a pain if you miss a \n. So it is a little more
readable on separate lines:
echo "p
q
" | fdisk
- or as was mentioned and is sometimes a preferred format of: -
cat << EOF | fdisk
p
q
EOF
Of course there is also other choices of fdisk:
fdisk, sfdisk, cfdisk, and I know I'm missing a few others (parted and
others).
But if you want just plain and simple fdisk to run, then the above works
great.
--RB
Jesse Keating wrote:
On Friday 31 October 2003 13:05, Alain TAUCH wrote:
p and q are fdisk commands, so it will print the
partion table then quit.
Er, right. I just didn't realize that the endlines were embedded.