d commandUsage: d [ -f file ] c[n][a][x][+][f|p] cmd [ arg ... ] or: d [ -f file ] m[n][a][x][+][f|p] [ make-arg ... ] or: d [ -f file ] s[n][a][x][+][f|p] [ additional-arg ... ] or: d [ -f file ] h or: d -f file
Run a command in the background, with its stdout and stderr redirected to
a file called 'out'
or to file.
The last form above changes this
name persistently in the $yostD_OUTFILE shell variable,
which defaults to 'out'.
The d command does
mv ,out out
before creating a new 'out' file
unless told to append instead.
c |
Run the following command. If escaped, you can use ; | > etc. | ||
m |
Run 'make'. |
||
s |
Run the same command again (extract the last command from 'out',
and run it again (without 'nice' unless you ask for 'nice' again). |
||
h |
Print a history of what happened 'out'. |
p |
Just print the command that would be executed; don't run it. | ||
f |
Waitt for it, and tail -f 'out'. |
||
w |
Waitt for it. |
n |
Do it 'nice'ly. |
||
a |
Append to 'out'. |
||
x |
Clear the screen. | ||
r |
Do it as root (easier if sudo is warmed up, as with 'sudo true'. | ||
+ |
Filter the command through the program 'c++filt'. | ||
! |
Disown the process, so it will continue if you log out. |
The d command comes along with several helper shell functions:
qtail -f outcat outqttail -20 outcqclear ; qcqqclear ; qqwqwait "$@" ; printf "\b" ; qqwqtwait "$@" ; printf "\b" ; 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 try to 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' [3] 3937 224 Z% [3] + 3937 done yostD_runCmd 224 Z% d sna [ sleep 5 ; echo Hello Folks ] [3] 3965 225 Z% [3] + 3965 done yostD_runCmd 225 Z% qq =d=tbegin 2012-02-07T03:03:54 EST Tue =d=see http://yost.com/computers/d/ =d=host ip2 =d=uname Darwin ip2 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64 =d=wd /Users/yost/web/yost/yost.com/computers/d =d=cmd sleep 5 ; echo Hello Folks =d= - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hello Folks 0.00s user 0.01s system 0% cpu 5.016 total =d= - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - =d=stat 0 =d=tend 2012-02-07T03:03:59 EST Tue ========= ===================================================================== =d=tbegin 2012-02-07T03:04:09 EST Tue =d=see http://yost.com/computers/d/ =d=host ip2 =d=uname Darwin ip2 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64 =d=wd /Users/yost/web/yost/yost.com/computers/d =d=cmd nice sleep 5 ; echo Hello Folks =d= - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hello Folks 0.00s user 0.01s system 0% cpu 5.016 total =d= - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - =d=stat 0 =d=tend 2012-02-07T03:04:14 EST Tue ========= ===================================================================== 226 Z% d sp sleep 5 ; echo Hello Folks 227 Z% d h =d=cmd sleep 5 ; echo Hello Folks =d=stat 0 =d=cmd nice sleep 5 ; echo Hello Folks =d=stat 0 228 Z% |
Download d.sh.
To use the d command and its helpers, you need to source d.sh from your zsh, bash, ksh, or sh. If your system does not have the tac command, you will need to install it for the s command to work.
I have tested this only with zsh 4.3.11.
Please feel free to send bug fixes.
out' file doesn't exist