1

I have a widget for mapping ^Z to fg:

function ctrlz() {
    [[ $(jobs | wc -l) > 0 ]] && {
        zle -I
        fg
    }
}

However, since widgets can't change $?, the exit status of the fg is ignored. An alternative approach of zle push-line; BUFFER="fg"; zle accept-line also works somewhat, but it adds an extra line (with prompt + fg) in the terminal output, as well as adding fg to history (even with HIST_NO_STORE set).

Is there any way to make a widget run fg with affecting $?, but without any unnecessary output (the [1] + continued python is bad enough) or history entries?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.