From 26cc1120960fc881e1f5c76a61dc1b3369451062 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Fri, 9 Mar 2018 08:56:13 -0600 Subject: [PATCH] Implement $last_pid, taking the place of %last Set as a global variable upon the execution of a background job. --- src/exec.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/exec.cpp b/src/exec.cpp index ecf2ffa29..2b13367ec 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -1149,6 +1149,7 @@ void exec_job(parser_t &parser, job_t *j) { j->set_flag(JOB_CONSTRUCTED, true); if (!j->get_flag(JOB_FOREGROUND)) { proc_last_bg_pid = j->pgid; + env_set(L"last_pid", ENV_GLOBAL, { to_string(proc_last_bg_pid) }); } if (!exec_error) {