8f73479a63cf4016fe0bfb8a79e5c094fcb834dd
3 local help="Usage: logq [-h|--help] COMMAND [ARG...]
5 Log Quietly. Run COMMAND with ARGs, log to temp file. Output return code,
6 command, and log path. Tail log if there is a failure.
7 Follows output format of logsave."
9 if [[ $1 == --help ||
$1 == -h ]]; then
13 if [[ $# == 0 ]]; then
14 echo "error: need 1 or more arguments
19 # deliniate arguments, so spaces aren't ambiguous
23 prettycommand
+="[$index]$x "
28 file="$(mktemp -d)/${file//[[:space:]\/]/_}"
29 # give us ~20 char filename max
32 printf "%s\n%s\n\n" "Log of $prettycommand" "$(date)" >"$file"
34 if [[ $
- != *x
* ]]; then
38 # we will propagate any errors
45 printf "\n%s\n%s\n" "$(date)" "----------------" >> "$file"
47 if [[ $logq_ret != 0 ]]; then
49 if [[ $
- != *x
* ]]; then
50 echo "logq failure. $x :"