I have to do a bunch of file copying, moving, svn check out commands, directory checking etc. and I'm trying to make a script to do it for me. I have basic python syntax, but I'm not sure how to use python to execute linux commands. I know the linux commands needed for example sudo apt-get install subversion i just don't know how to wrap python around it.
Specifically, could anyone give examples on how to:
- Check if a package (like svn) is installed, if not then install it. I know this is a simple if-statement but no idea how to write it...
- Check if a folder with a specific name is installed, if not create it on the desktop/some other directory. Similar to the above I would assume.
- Move to a certain directory and execute a command (like I want to extract a .tgz file in a certain directory)
There's more but I want to grasp basic principles and actually learn how to execute linux commands using python scripting. Thanks for your time~
EDIT: I am specifically required to use python