3 local help="Usage: logq [-h|--help] COMMAND [ARG...]
5 Log Quietly. Run COMMAND with ARGs, log to temp file. Output return code,
8 Minor details: Use logsave if available, which adds informational header/footer
9 to log file. Logfile is put in random temp dir, with filename made from the
10 alphanumeric characters of COMMAND + ARGs."
12 if [[ $1 == --help ||
$1 == -h ]]; then
16 if [[ $# == 0 ]]; then
17 echo "error: need 1 or more arguments
25 prettycommand
+="[$index]$x "
31 file="$(mktemp -d)/${file//[^[:alnum:]]/}"
33 printf "%s\n%s\n\n" "log of $prettycommand" "$(date)" >"$file"
35 # we will propagate any errors
37 [[ $e == *e
* ]] && set +e
40 [[ $e == *e
* ]] && set -e
42 printf "\n%s\n%s\n%s" "----------------" "$(date)" "end of log" >>"$file"
45 echo -n "$prettycommand"