SYSTEM

OS functions

example for OS function os.system() “executing a shell command”

Jeffrin
$python ossystem.py 
  File: ossystem.py
  Size: 69        	Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d	Inode: 27004016    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/ jeffrin)   Gid: ( 1000/ jeffrin)
Access: 2019-06-15 21:20:25.968237118 +0530
Modify: 2019-06-15 21:20:20.279878821 +0530
Change: 2019-06-15 21:20:20.279878821 +0530
 Birth: -
0

$cat ossystem.py

import os

#print dir(os.system)
print os.system("stat ossystem.py")

$emacs ossystem.py

$python ossystem.py 
/home/jeffrin/SYSTEM
0

$cat ossystem.py

import os

#print dir(os.system)
print os.system("pwd")

$

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top