https://github.com/jwerle/batsh
Queue bash commands to run with a given concurrency
https://github.com/jwerle/batsh
Last synced: 3 months ago
JSON representation
Queue bash commands to run with a given concurrency
- Host: GitHub
- URL: https://github.com/jwerle/batsh
- Owner: jwerle
- License: mit
- Created: 2014-09-09T19:03:53.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-09-09T19:05:41.000Z (almost 12 years ago)
- Last Synced: 2025-04-22T21:51:16.616Z (about 1 year ago)
- Language: Shell
- Size: 133 KB
- Stars: 13
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
batsh(1)
=======
Queue bash commands to run with a given concurrency. Similar to
`batch(1)` without the crap
## install
```sh
$ bpkg install jwerle/batsh
```
## usage
```
usage: batsh [-hV]
or: batsh push
or: batsh run [script]
or: batsh clear
or: batsh reset
or: batsh concurrency <n>
```
`batsh(1)` allows the user to queue jobs that will run with a set
concurrency (Default `0`). Jobs are pushed with `batsh push` onto
a queue and are ran with `batsh run`. The queue can be cleared with
`batsh clear`.
## push
Jobs that are pushed are just shell scripts that are invoked with the
batsh jobs are ran.
```sh
$ batsh push 'echo beep'
```
## run
Jobs are ran with `batsh run` which accepts optional code to be executed
when all jobs have completed. This command has an alias of `batsh r`.
```sh
$ batsh run 'echo done'
beep
done
```
## concurrency
Concurrency can be set with `batsh concurrency`. It has an alias of
`batsh c`.
```sh
$ batsh concurrency 2
```
## batsh instance
`batsh(1)` manages its state in a directory set with the `BATSH`
environment variable. The default is `${HOME}/.batsh`. A user can manage
multiple `batsh` instances by settings this variable.
## batch scripts
`batsh(1)` can run a script exposing a few helper functions. Batsh
script is just bash.
```sh
#!/usr/bin/env batsh
## jobs
push 'echo beep'
push 'echo boop'
push 'sleep 1 && echo beeps'
push 'sleep 1 && echo boops'
## set concurrency
concurrency 2
## run
run 'echo done'
```
## license
MIT