Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 2016 16:50:46 +0100
From:      Polytropon <freebsd@edvax.de>
To:        mexas@bris.ac.uk
Cc:        freebsd-questions@freebsd.org
Subject:   Re: tcsh fg bug?
Message-ID:  <20160114165046.caf70131.freebsd@edvax.de>
In-Reply-To: <201601141500.u0EF0OSl028841@mech-as222.men.bris.ac.uk>
References:  <201601141500.u0EF0OSl028841@mech-as222.men.bris.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 14 Jan 2016 07:00:25 -0800 (PST), Anton Shterenlikht wrote:
> I'm using tcsh.
> 
> > jobs
> [2]  + Running                       xpdf pap.pdf
> [3]  - Running                       xautolock -time 1 -locker slock
> > fg 3
> xpdf pap.pdf (wd: ~/nobkp/out/2016/autotune)
> 
> 
> which is wrong, right?

Looks like it. :-)



> Can anybody reproduce this behaviour?

Yes:

% jobs
[1]    Suspended                     gv aaaa.ps
[2]    Suspended                     xpdf /tmp/w3dzz-antenna-iss-1-31.pdf
[3]  - Suspended                     xpdf /tmp/robe.pdf
[4]  + Suspended                     xpdf /tmp/anwenderaspekte_svm_3.3.pdf

% fg 3
xpdf /tmp/anwenderaspekte_svm_3.3.pdf




But using the correct syntax, this happens (as expected):

% fg %3
xpdf /tmp/robe.pdf



Explanation from "man csh":

       There  are  several  ways to refer to jobs in the shell.  The character
       `%' introduces a job name.  If you wish to refer to job number  1,  you
       can  name  it  as `%1'.  Just naming a job brings it to the foreground;
       thus `%1' is a synonym for `fg %1', bringing job 1 back into the  fore-
       ground.  Similarly, saying `%1 &' resumes job 1 in the background, just
       like `bg %1'.  A job can also be named by an unambiguous prefix of  the
       string  typed  in to start it: `%ex' would normally restart a suspended
       ex(1) job, if there were only one suspended job whose name  began  with
       the  string  `ex'.   It is also possible to say `%?string' to specify a
       job whose text contains string, if there is only one such job.

[...]

       fg [%job ...]
               Brings  the  specified jobs (or, without arguments, the current
               job) into the foreground, continuing each  if  it  is  stopped.
               job may be a number, a string, `', `%', `+' or `-' as described
               under Jobs.  See also the run-fg-editor editor command.


So the command

	> fg %3
	     ^

will probably do what you want. :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160114165046.caf70131.freebsd>