Skip to content

Commit 6537cd4

Browse files
committed
shell me
1 parent f7117c5 commit 6537cd4

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

json/parse-json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
script_dir = os.path.dirname(__file__)
77
print("The Script is located at:" + script_dir )
8-
script_absolute_path = os.path.join(script_dir, 'example.json')
8+
script_absolute_path = os.path.join(script_dir, 'files/example.json')
99
print("The Script Path is:" + script_absolute_path)
1010

1111
# Script to parse JSON
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import os
2+
3+
os.system('echo "hello"')

operating-system/files/param.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
echo $1
3+
echo $2
4+
echo $3
5+
exit 0
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
import os
22
import subprocess
33

4+
5+
# Script execution without parameters
6+
47
script_dir = os.path.dirname(__file__)
58

69
script_abosulte_path = os.path.join( script_dir + "/files/script.sh")
710

811
subprocess.call(['sh', script_abosulte_path])
912

10-
os.system("cat /etc/hosts")
13+
14+
# Script execution with parameters
15+
16+
param_script_abosulte_path = os.path.join( script_dir + "/files/param.sh")
17+
18+
subprocess.call(['sh', param_script_abosulte_path, 'param1 param2'])
19+
20+
21+
22+
23+
24+
25+

0 commit comments

Comments
 (0)