Skip to main content

Easily run bash commands

Project description

mini_bash

Summary: A lightweight Python package for executing bash commands programmatically with automatic error handling. Raises an exception if the shell command returns a non-zero exit code.

Installation

You can install mini_bash using pip:

pip install mini_bash

Usage

from mini_bash import mini_bash

# Execute a command and capture output
std_out_str, std_err_str = mini_bash('ls -ltr')

# The function returns a tuple of (stdout, stderr)
print(f"Output: {std_out_str}")
print(f"Errors: {std_err_str}")

Error Handling

If the command exits with a non-zero return code, a subprocess.CalledProcessError is raised:

from mini_bash import mini_bash

try:
    mini_bash('exit 1')
except Exception as e:
    print(f"Command failed: {e}")

Contribution & License

If you have any suggestions, improvements, or issues regarding mini_bash, feel free to open an issue or submit a pull request on GitHub.

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mini_bash-0.1.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mini_bash-0.1.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file mini_bash-0.1.2.tar.gz.

File metadata

  • Download URL: mini_bash-0.1.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.9 Darwin/25.2.0

File hashes

Hashes for mini_bash-0.1.2.tar.gz
Algorithm Hash digest
SHA256 402e94eaeefa2d6edefe17f9d56285e3947bb434df00e00b2f6ca2a24af692fd
MD5 817b202d9a2697f37bc2f04ddcbf6bd1
BLAKE2b-256 990dff79b6d6af238c5cc5c97d00ed135134b498267230f4fb99ca9c6d001407

See more details on using hashes here.

File details

Details for the file mini_bash-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mini_bash-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.9 Darwin/25.2.0

File hashes

Hashes for mini_bash-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5216b02562351486b0acd2a02f44a566ba27f281da7609f451dea8d832fc4784
MD5 f4a81848892db8cb8b2086f7ddf4061b
BLAKE2b-256 3affed9fae2592800af80e208d28e5a298940158efb97d345d15c48cd5284e2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page