Skip to content

Commit f7117c5

Browse files
committed
os module
1 parent 1455c45 commit f7117c5

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

operating-system/files/script.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /bin/bash
2+
3+
echo "This is a shell script"

operating-system/shell-execution.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import os
2+
import subprocess
3+
4+
script_dir = os.path.dirname(__file__)
5+
6+
script_abosulte_path = os.path.join( script_dir + "/files/script.sh")
7+
8+
subprocess.call(['sh', script_abosulte_path])
9+
10+
os.system("cat /etc/hosts")

0 commit comments

Comments
 (0)