Good idea to me!!!
We can avoid to use session here by using a /tmp/fdisk-cmd file.

About writing this file, we need to use python rather than echo command as possible.