Make bashmark a command

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-10-22 23:44:53 +03:00
parent 859ea19d11
commit bdb722dc7f
Signed by untrusted user who does not match committer: ari
GPG key ID: A50D5B4B599AF8A2
3 changed files with 17 additions and 13 deletions

View file

@ -1,6 +1,6 @@
export BAZP_NAME='cmdutils-baz-plugin'
export BAZP_LICENSE='WTFPL'
export BAZP_VER=3
export BAZP_VER=4
export BAZP_AUTHOR='Ari Archer'
export BAZP_SRC='plugin'
export BAZP_METHOD='git'

16
plugin/commands/bashmark Normal file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env sh
set -e
main() {
if [ ! "$1" ]; then
echo 'Usage: BMT=<times to run> time bashmark "<command>"' >&2
return 1
fi
for num in $(seq -- "${BMT:-1000}"); do
printf '%d\n%d\n%d\n' "$num" "$num$num" "$num$num$num" | bash -c -- "$1"
done
}
main "$@"

View file

@ -1,12 +0,0 @@
#!/usr/bin/env bash
if [ ! "$1" ]; then
echo 'Usage: BMT=<times to run> time bashmark "<command>"' >&2
return 1
fi
ts="${BMT:-1000}"
for num in $(seq -- "$ts"); do
printf '%d\n%d\n%d\n' "$num" "$num$num" "$num$num$num" | bash -c -- "$1"
done