Skip to main content

A simple bulk shell command execution package

Project description

BulkExec

BulkExec is a command-line python argument evaluator that iterates through iterable arguments to launch multiple commands with different argument combinations.

Installation

BulkExec can be installed directly from PyPI:

pip install bulkexec

Usage

BulkExec evaluates every string argument as a Python expression. If the argument is not a valid Python expression then the argument is not modified. If the argument is a valid Python expression, then the argument is replaced with it's evaluated value.

$ py -m bulkexec echo "10 ** 5"
10000

If the evaluated value is an iterable (other than a string or bytes), the argument will be replaced with each element in the iterable one-by-one.

$ py -m bulkexec echo "range(5)"
0
1
2
3
4

If multiple arguments are iterables then commands will be launched by pairing the values element-wise. Shorter iterables cycle as to not exhaust their values.

$ py -m bulkexec echo "range(2)" "range(4)"
0 0
1 1
0 2
1 3

Example Uses

Pinging multiple IP addresses:

py -m bulkexec ping "[f'192.168.1.{i}' for i in range(10)]" /n 1
Example Output Pinging 192.168.1.0 with 32 bytes of data: Reply from 192.168.1.162: Destination host unreachable.
Ping statistics for 192.168.1.0:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),

Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=23ms TTL=64

Ping statistics for 192.168.1.1:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 23ms, Maximum = 23ms, Average = 23ms

Pinging 192.168.1.2 with 32 bytes of data:
Reply from 192.168.1.162: Destination host unreachable.

Ping statistics for 192.168.1.2:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),

Special Cases

Identical Argument Names

If a command argument shares the same name as a BulkExec argument it will by default be ignored. Only the last value of the argument will be used by BulkExec.

py -m bulkexec ping -h 

To pass this argument to the command instead, it can be wrapped in a combination of single and double quotes.

py -m bulkexec ping "'-h'"
py -m bulkexec ping '"-h"'

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

bulkexec-0.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

bulkexec-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file bulkexec-0.0.1.tar.gz.

File metadata

  • Download URL: bulkexec-0.0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for bulkexec-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b7c7af8a963dba156e9cd9c4180269ae101b70d2ebe0c8c77eaff2f2a74fcbc0
MD5 9758a8db1910c88d6236670493fc177d
BLAKE2b-256 8b6806dcce3bd5ad2a3263e43396440d3315562cbf3b9f5ff8475b59523bf0a3

See more details on using hashes here.

File details

Details for the file bulkexec-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: bulkexec-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for bulkexec-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6868e9ad9707441ca996d6ad49d939165b75cce453953cac2cac4437440a65fc
MD5 44c8ccc058af12f3b883f975a59e411b
BLAKE2b-256 005cdb496ed24330d349a1899d9b8daac11bcb1e18bb6202a5b175d14dd407f3

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