bb/helpers/bbcmd
Bruce Hill 865092c656 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.
2020-02-24 01:31:39 -08:00

12 lines
311 B
Bash
Executable File

#!/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