diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-02-24 01:31:39 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-02-24 01:31:39 -0800 |
| commit | 865092c656af70bd5317513d8e0ed87fdc1c9acd (patch) | |
| tree | c4311c89b75322b4bb9d7f3547ff0534b935d68f /helpers/bbcmd | |
| parent | a8fd1743191bdb0a7453a2d90055e9dcc61a5ece (diff) | |
Major update: instead of defining all the helper functions as static
C-strings prefixed to commands (modified by the Makefile), the helper
functions are now standalone scripts in the helpers/ dir, which gets
added to "$PATH" when running bb.
Diffstat (limited to 'helpers/bbcmd')
| -rwxr-xr-x | helpers/bbcmd | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/helpers/bbcmd b/helpers/bbcmd new file mode 100755 index 0000000..fdc4e78 --- /dev/null +++ b/helpers/bbcmd @@ -0,0 +1,11 @@ +#!/bin/sh +if [ $# -eq 0 ]; then cat >> $BBCMD; exit; fi +for arg; do + shift + if expr "$arg" : '^[^:]*:$' >/dev/null; then + if [ $# -gt 0 ]; then printf "$arg%s\\0" "$@" >> $BBCMD + else sed "s/\([^\\x00]\+\)/$arg\1/g" >> $BBCMD; fi + exit + fi + printf "%s\\0" "$arg" >> $BBCMD +done |
