Skip to content

Commit

Permalink
Add template for minimal "shell" python script
Browse files Browse the repository at this point in the history
  • Loading branch information
mgunyho committed Jul 3, 2022
1 parent bc52e24 commit 98f2b08
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions templates/shell_min.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import subprocess

def sh(cmd: str, return_string: bool = True):
"""
Run chell command 'cmd' and return stdout.
"""
res = subprocess.check_output(cmd, shell=True)
if return_string:
res = res.decode()

return res

0 comments on commit 98f2b08

Please sign in to comment.