d commandIf you use the command line very much at all...
Usage: d [ -f file ] c[a][n][r][x][f|w|!|p] cmd [ arg ... ] or: d [ -f file ] m[a][n][r][x][f|w|!|p] [ make-arg ... ] or: d [ -f file ] [s|e][a][n][r][x][f|w|!|p] [ additional-arg ... ] or: d [ -f file ] h[x]
Run a command in the background, with its stdout and stderr redirected to a log file called 'out'
or to file. The -f file option changes the name of the log file persistently.
The 'd' command does
   mv out ,out
before creating a new 'out' file unless told to append instead.
d' command, the todo argument,
must consist of one of these:
| c | Run the following command. You can use ; | >etc. if you escape them. | ||
| m | Run ' make' with the arguments given. | ||
| s | Run the same command again. Extracts the last command from ' out' and runs it again, as root if the previous run was as root, and without 'nice' unless you ask for 'nice' again. | ||
| e | like sbut lets you edit the command before running | ||
| h | Print a history of commands logged in ' out'. | 
| a | Append to ' out'. | ||
| n | Run with ' nice'. | ||
| r | Run as root. | ||
| x | Clear the screen. | ||
| , | mv ,out outbefore proceeding. | 
| p | Just print the command that would be executed; don't run it. | ||
| w | Wait for it. | ||
| f | Wait for it, and show the command output as it progresses. | ||
| ! | Disown the process, so it will continue if you log out. Put this last so your shell won't interpret it as asking for shell history. | 
You have to go to some lengths to preserve quotes around arguments, e.g.,
   d c echo '"'a   b'"'
The 'd' command comes along with several helper shell functions:
qtail -f outcat outqttail -20 outcqclear ; qcqqclear ; qqwqwait "$@" ; printf "\007" ; qqwqtwait "$@" ; printf "\007" ; qt
The output from d into the file 'out' consists of
   prologue
   output from the command
   epilogue
as shown in the example below, which does this:
c) in the background, with output to the 'out' file.
	s) comand again, with nice (n), appending (a) the output to the existing 'out' file.
	out' file.
	p) if we run the same command again, using ‘d s’.
	h) of commands and results contained in the 'out' file.
| 223 Z% d c 'sleep 5 ; echo Hello Folks' [5] 3937 224 Z% [5] + 3937 done yostD_run 224 Z% d sna Run again nice: sleep 5 ; echo Hello Folks! [5] 3965 225 Z% [5] + 3965 done yostD_run 225 Z% qq =d= tbegin 2014-06-16T21:23:51 PDT Mon =d= see http://yost.com/computers/d/ =d= host DaveMBP =d= uname Darwin DaveMBP 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 =d= path /Users/yost/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:: =d= wd /Users/yost/Desktop =d= cmd sleep 5 ; echo Hello Folks =d==begin / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ Hello Folks 0.01s user 0.02s system 0% cpu 5.029 total =d==end \ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / =d= status 0 =d= tend 2014-06-16T21:23:57 PDT Mon ========== ===================================================================== =d= tbegin 2014-06-16T21:24:05 PDT Mon =d= see http://yost.com/computers/d/ =d= host DaveMBP =d= uname Darwin DaveMBP 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 =d= path /Users/yost/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:: =d= wd /Users/yost/Desktop =d= cmd nice sleep 5 ; echo Hello Folks! =d==begin / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ Hello Folks! 0.01s user 0.02s system 0% cpu 5.029 total =d==end \ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / =d= status 0 =d= tend 2014-06-16T21:24:10 PDT Mon ========== ===================================================================== 226 Z% d sp sleep 5 ; echo Hello Folks! 227 Z% d h tbegin 2014-06-16T21:23:51 PDT Mon cmd sleep 5 ; echo Hello Folks status 0 tend 2014-06-16T21:23:57 PDT Mon ====== ===================================================================== tbegin 2014-06-16T21:24:05 PDT Mon cmd nice sleep 5 ; echo Hello Folks! status 0 tend 2014-06-16T21:24:10 PDT Mon ====== ===================================================================== 228 Z% d erf Run again sudo: echo Hello, Folks! Password: Hello, Folks! 0.01s user 0.02s system 132% cpu 0.024 total 229 Z% d h tbegin 2014-06-16T21:24:44 PDT Mon cmd sudo echo Hello, Folks! status 0 tend 2014-06-16T21:24:44 PDT Mon ====== ===================================================================== 230 Z% | 
Download d.sh.
To use the d command and its helpers, you need to source d.sh from your zsh or bash.
I have tested this only with zsh 5.0.5 and bash 3.2.51(1)-release. Please feel free to send bug fixes.
out' file doesn't exist