On 06/20/2013 06:49 PM, Robert Carpenter wrote:
> I do this all the time under fish and have no problem. ^z to background
> a running task, `jobs` to see what is running, `fg` or `fg N` to bring
> something forward.  It even works with the `command &` syntax to
> background a job at command time.

“fg” and “fg %n” are very similar in both shells; “fg” means “bring the 
most recent job to the foreground”.

Bash offers the additional syntax “fg -” which brings the 
next-most-recent job to the foreground.  This is useful for alternating 
between two jobs.  Let's say we start two terminal applications:

$ octave
octave:1> ^Z
[1]+  Stopped                 octave
$ emacs -nw
^Z
[2]+  Stopped                 emacs -nw
$ jobs
[1]-  Stopped                 octave
[2]+  Stopped                 emacs -nw

Note the “+” and “-”.  Now, successive “fg -”s switch back and forth:

$ fg -
octave
^Z
$ fg -
emacs -nw

By the way, bash's “fg” offers another nicety: it remembers which jobs 
were started in the background (i.e. with “&”, rather than sent to the 
background later) and excludes them from “fg [-]”.  In the example, say 
I open a document with “gv &”; if I then say “fg” it is unlikely that I 
want to bring “gv” to the foreground.


        Elias


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to