8000 Set job-control to full (was: job control (%last/$last_pid) does not work within scripts) · Issue #5036 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

Set job-control to full (was: job control (%last/$last_pid) does not work within scripts) #5036

@deanveloper

Description

@deanveloper

fish 2.7.1

Ubuntu 18.04, GNOME terminal (xterm-256color)

third party extensions do not affect the issue

I would expect %last to be different for each sleep call

test.fish

 ><>  ~/Desktop > cat test.fish                                        2:29:12pm

for i in (seq 1 5)
	sleep 5 &
	echo %last
end

Expected

 ><>  ~/Desktop > fish test.fish                                       2:29:14pm
30528
30529
30530
30531
30532

Actual

 ><>  ~/Desktop > fish test.fish                                       2:29:14pm
30528
30528
30528
30528
30528

Using (jobs -lp) as a substitute for %last seems to work, although I would expect %last to work for this.

My use case for this is that I want to display an image which has some information on it, and I want to record the information within the image, then write that information to a file, close the image, and open the next one.

for image in (ls *.png)

    eog $image &
    set PID %last    # substituting this with (jobs -lp) makes it work, although %last should work fine...
    echo "What does the image say?"
    read info
    kill $PID
    echo "$image - $info" >> my.file
end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0