From owner-freebsd-questions@freebsd.org Thu Jan 14 15:50:56 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC10DA8313C for ; Thu, 14 Jan 2016 15:50:56 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 756141C83 for ; Thu, 14 Jan 2016 15:50:56 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de (port-92-195-101-208.dynamic.qsc.de [92.195.101.208]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id 57A7D2784F; Thu, 14 Jan 2016 16:50:46 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id u0EFok2Y002674; Thu, 14 Jan 2016 16:50:46 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Thu, 14 Jan 2016 16:50:46 +0100 From: Polytropon 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> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2016 15:50:56 -0000 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, ...