Execute shell commands and return output (cross-platform)
| Flag | Short | Description | Takes Value |
|---|---|---|---|
--help |
-h |
Show help message and usage information | Yes |
--stream |
-s |
Stream output in real-time instead of buffering | No |
-S |
— |
Run command via specified shell (e.g. /bin/sh, /bin/zsh) | Yes |
-c |
— |
Read commands from the following argument string | No |
-d |
— |
Set working directory before executing the command | Yes |
-t |
— |
Set execution timeout in seconds | Yes |
# Run a simple command and capture output $ scorpiox-bash -c "ls -la /tmp" total 48 drwxrwxrwt 12 root root 4096 Mar 13 10:00 . drwxr-xr-x 19 root root 4096 Mar 01 08:00 .. -rw-r--r-- 1 user user 512 Mar 13 09:45 data.csv
# Use --stream to see output as it happens (useful for long-running commands) $ scorpiox-bash --stream -c "tail -f /var/log/syslog" Mar 13 10:01:12 host kernel: [INFO] Network interface up Mar 13 10:01:13 host systemd[1]: Started service...
# Execute command in a specific directory $ scorpiox-bash -d /opt/myproject -c "git status" On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean
# Run command through zsh instead of the default shell $ scorpiox-bash -S /bin/zsh -c "echo $ZSH_VERSION && whoami" 5.9 developer
# Set a 30-second timeout — command is killed if it exceeds the limit $ scorpiox-bash -t 30 -c "find / -name '*.log' -size +100M" /var/log/application.log /home/user/debug.log # Combine timeout with streaming for monitored execution $ scorpiox-bash -t 60 --stream -c "make -j$(nproc) && make test"
# On Windows, executes via cmd.exe; on Linux/macOS via /bin/sh # Consistent interface regardless of platform $ scorpiox-bash -c "echo Hello from $(uname -s 2>/dev/null || echo Windows)" Hello from Linux # Pipe commands together $ scorpiox-bash -c "cat /etc/passwd | grep -c '/bin/bash'" 5
scorpiox/scorpiox-bash.clibsxutil