/shoper

Simple Shell Operator for Python

Primary LanguagePythonMIT LicenseMIT

shoper

Simple shell operator module for Python

Test Upload Python Package

Installation

$ pip install -U shoper

Example

List directory contents with ls.

from shoper.shelloperator import ShellOperator

sh = ShellOperator()
sh.run('ls -l')

Write and sort random numbers.

from shoper.shelloperator import ShellOperator

sh = ShellOperator()
sh.run(
    args=[
        'echo ${RANDOM} | tee random0.txt',
        'echo ${RANDOM} | tee random1.txt',
        'echo ${RANDOM} | tee random2.txt'
    ],
    output_files_or_dirs=['random0.txt', 'random1.txt', 'random2.txt']
)
sh.run(
    args='sort random[012].txt | tee sorted.txt',
    input_files_or_dirs=['random0.txt', 'random1.txt', 'random2.txt'],
    output_files_or_dirs='sorted.txt'
)