https://github.com/maxg87/shell-interface
Helpful and convenient utilities to interact with UNIX shells
https://github.com/maxg87/shell-interface
python3 shell
Last synced: 2 months ago
JSON representation
Helpful and convenient utilities to interact with UNIX shells
- Host: GitHub
- URL: https://github.com/maxg87/shell-interface
- Owner: MaxG87
- License: gpl-3.0
- Created: 2023-06-15T09:31:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2026-01-10T11:31:09.000Z (6 months ago)
- Last Synced: 2026-01-12T19:51:32.934Z (6 months ago)
- Topics: python3, shell
- Language: Python
- Homepage:
- Size: 1.16 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/psf/black)
[](https://pycqa.github.io/isort/)
[](http://mypy-lang.org/)
[](http://www.gnu.org/licenses/gpl-3.0)
# Shell Interface
A lightweight Python library providing convenient utilities to interact with UNIX shells.
## Features
- Execute shell commands safely with error handling
- Pipe the output of one command to another
- Retrieve system user and group information
- Logging support with `loguru` (if installed)
## Usage
### Running Shell Commands
```python
from shell_interface import run_cmd
result = run_cmd(cmd=["ls", "-l"], capture_output=True)
print(result.stdout.decode())
```
### Piping Commands
```python
from shell_interface import pipe_pass_cmd_to_real_cmd
result = pipe_pass_cmd_to_real_cmd("echo Hello", ["grep", "Hello"])
print(result.stdout.decode())
```
### Getting User and Group Information
```python
from shell_interface import get_user, get_group
user = get_user()
group = get_group(user)
print(f"User: {user}, Group: {group}")
```