# From: "Bart Schaefer" # Subject: Re: Contrl-Z action. # # On Nov 5, 8:49pm, Alexey Solovyov wrote: # } Subject: Re: Contrl-Z action. # } # } > :But I've got a question. Once I came up why I want to have my job # } > :suspended by pressing Cntrl-Z ? Ok, I want it to run in background # } > :right after that. # } > # } > I can't think of a elegant way of doing this automatically without a # } > lot of overhead. # } # } Thanks, I will probably do it this way though actually I was thinking # } about changing the sources... :) # # Eww, don't do that. # # } But anyway suggestions about eliminating the second Ctrl-Z are welcome. function autobg() { jobs -s >| /tmp/j$$ while read jnum jdesc do bg %${${jnum#\[}%\]} done < /tmp/j$$ rm -f /tmp/j$$ } # function precmd() { # autobg # } # # I really question whether this is the behavior you want, though. You # might want to change the `bg ...' command in autobg to something like # # case $jdesc in # (*( vi | vim | *emacs )*) ;; # Don't autobg any editors, # (*) bg %${${jnum#\[}%\]} ;; # but anything else is OK. # esac # # or possibly something even more restrictive where you list the things # that you *do* want to autobg rather than those that you don't.