diff --git a/geesh/environment.scm b/geesh/environment.scm index e2ec8ee..784a47f 100644 --- a/geesh/environment.scm +++ b/geesh/environment.scm @@ -23,6 +23,7 @@ #:use-module (srfi srfi-26) #:export (get-status set-status! + get-root-pid getvar setvar! unsetvar! @@ -60,7 +61,7 @@ ;;; Code: -;;; Status. +;;; Status and PID. (define *status* 0) @@ -72,6 +73,11 @@ "Set the current status." (set! *status* n)) +(define *root-pid* (getpid)) + +(define (get-root-pid) + *root-pid*) + ;;; Variables. diff --git a/geesh/word.scm b/geesh/word.scm index bc01caa..07de26f 100644 --- a/geesh/word.scm +++ b/geesh/word.scm @@ -230,6 +230,7 @@ the environment. If @var{name} is unset, return @code{#f}." ("0" (car (program-arguments))) ("#" (number->string (length (cdr (program-arguments))))) ("?" (number->string (get-status))) + ("$" (number->string (get-root-pid))) (x (let ((n (string->number x))) (if (and n (integer? n) (> n 0) (<= n (length (cdr (program-arguments)))))