Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: fg jobs info

On Sun, 2 Sep 2007, Bart Schaefer wrote:

Have a look at the variables jobdirs, jobtexts, and jobstates in the zsh/parameter module. Or there's a lazier way out:

that seems reasonably elegant... as long as a) there's only one suspended job or b) jobs are only referred to by number :(

if the there's more than one job and either 1) the current job is implied or 2) a job is specified not by job number, things get messy.

} unless there's a way to simulate the fg command (ie; a "-n" dry run
} argument)

The "jobs" command should accept all the same job-identifier patterns
as "fg", and in recent zsh "jobs" doesn't lose track of the job list
when run in a subshell, so you can do things like

that doesn't seem to work in 4.3.2. i'm using versions as old as 4.2.1 so the foo=$(jobs) trick won't work all around, and it's hackish enough that it fails to inspire an upgrade.

also, here's a case where (given what i'm trying to do) i'm confident that anything would fail (at least partially), short of some non-trivial updates to zsh:

% man sh

% man zsh

% jobs
[1]  - suspended  man sh
[2]  + suspended  man zsh

% fg %1 %2


 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808

	"The lie can be maintained only for such time as the State can
	 shield the people from the political, economic and/or military
	 consequences of the lie. It thus becomes vitally important for
	 the State to use all of its powers to repress dissent, for the
	 truth is the mortal enemy of the lie, and thus by extension,
	 the truth becomes the greatest enemy of the State."
		-- Josef Goebbels

Messages sorted by: Reverse Date, Date, Thread, Author