#! /bin/sh IFS=' ' case \ $*\ in *\ -*) if test -t 0 -o -t 1 then cat >> /dev/tty << eot WARNING: bang does not accept any -flags, only files. DESCRIPTION. bang is like cat but interprets !command escapes with either (1) SHELL=$SHELL, or (2) eval (if SHELL is empty or SHELL=eval) USAGE. i (~saor) use bang as input to other commands: bang|dc !getconf INT_MAX to make simple/interactive notes: tee INDEX! | bang > INDEX welcome to my humble directory. !ls|nl ^D (ctrl+d) and as a basic preprocessor to avoid painful shell quoting: SHELL=dc bang file BUGS. bang can only handle one-liners. bang is inefficient, each !command is a new process. bang might strip spaces/tabs if IFS behaves weirdly bang chokes on null \000 bytes ^@ bang behaves differently if stdout is not a terminal eot fi ;; esac case "$#" in \0) cat;; *) while : do cat <"$1" case "$#" in \1) break;; esac shift done ;; esac | while IFS=' ' read -r line do case "$line" in \!*) IFS=' ' case $SHELL in ''|eval) eval "`sed 's/!//'`";; *) sed 's/!//' | $SHELL;; esac | if test -t 1 then cat else tee -a /dev/tty fi ;; *) cat;; esac << eot $line eot done