Almost all modern programming languages has the capability to execute terminal commands (in python you can use the os
or subprocess
modules).
But for your project I would be easier if you use bash script http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html