From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mortimer Cladwell Newsgroups: gmane.lisp.guile.user Subject: Can system modify an environment variable in the current environment? Date: Thu, 2 Sep 2021 15:49:36 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13938"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Thu Sep 02 21:50:08 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mLsit-0003UC-Ot for guile-user@m.gmane-mx.org; Thu, 02 Sep 2021 21:50:07 +0200 Original-Received: from localhost ([::1]:59588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLsis-0005WP-CN for guile-user@m.gmane-mx.org; Thu, 02 Sep 2021 15:50:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLsic-0005WG-Nc for guile-user@gnu.org; Thu, 02 Sep 2021 15:49:50 -0400 Original-Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:33502) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mLsib-0000RW-89 for guile-user@gnu.org; Thu, 02 Sep 2021 15:49:50 -0400 Original-Received: by mail-ot1-x32b.google.com with SMTP id c42-20020a05683034aa00b0051f4b99c40cso4027713otu.0 for ; Thu, 02 Sep 2021 12:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=SKuj8zDZ8frOgpK6gPwJ3u4uG+ext+ZrfJkvG3C9NYQ=; b=jo07F6pmVNkOv0xSIUkuioUh9JyTimAMrtvIg+MeMi2G3EYgPU8y8FwhrOgzUY4r9U ft0AE7U8D44w/Zlsvdr77iYhAXp+1wJvnXBiQv0erD5DLALl1ZI+UXAuP3rTl37xhhQy /+TSgWm8J6TdF/RGEH61b3SddjblePmFVxO5OPToSlaSoi4w7FrAMyIJawW7UVXTj4UY L9/VBlkNwZ3sexYhYENyRln453/ArJrhuryU9Fe28M4Y6bavP3DaHkx7DQdH2NW2MakL vsFhzX3R5N53FLlFODpRePDwXJ/bQGn0NyHqgNZny+v6FWBau8v/e7wHT8NkTnXR/ZkK SHsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=SKuj8zDZ8frOgpK6gPwJ3u4uG+ext+ZrfJkvG3C9NYQ=; b=ezdtY7c7VbObIXPzmPMYEGFavx85QyCWKcHk1JAbdFHNovZKYuEfcdq54Kl7hg3JBu m6oFDInuCHEk/JDbfsPsKPvcH1AxbB+NiLqQaveTIf9W4H/YpGYwJ1I9ioN/K20c8nAC yBcFRWQwbtZqjBWmvX3isBZNoYihDUq/NK6jrp5s9P7xTzYNPaG/IbnxC73zR9wj5xpk woTybIiH3QQMAfiBKAHANj6t2b3rt7NEjTcTRaRrWoKVUV2vcLwcY3pO6rX+FU8AMCDt xHmwjalmmkH8M8uBKeLk3fsVDKh/T/Re3JKYtMWBO0HlW2gKegC6xuvKHBzo/Y/XcYik tO3A== X-Gm-Message-State: AOAM532768sgc8lPPY9QMkcDfVXyH1NyYfWLP/KUC31ILSrDypWxOusE 0NqYRVxvjCrXbSjfRgODQ6aM4JGFOlM4vHUmEppsYaWVUQTqEQ== X-Google-Smtp-Source: ABdhPJxXCcLoAM2WaIPpffMqHruWOolQWwKi/dtz6z9x8lvmUr40hNaIKVPmVzdYSdJ/waadSeS7GWkdnFIMI8CicAQ= X-Received: by 2002:a9d:17c5:: with SMTP id j63mr4102043otj.208.1630612187216; Thu, 02 Sep 2021 12:49:47 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=mbcladwell@gmail.com; helo=mail-ot1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17705 Archived-At: Hi, Consider my file test.scm: (define (main args) (let* ((myvar (string-append "export GUILE_LOAD_PATH=/some/random/text:$GUILE_LOAD_PATH")) (statement1 (system (string-append "echo " myvar " >> $HOME/.bashrc"))) (statement2 (system myvar))) (write myvar))) At the terminal: mbc@HP8300:~/temp$ echo $GUILE_LOAD_PATH /home/mbc/.guix-profile/share/guile/site/3.0 mbc@HP8300:~/temp$ guile -e main -s test.scm "export GUILE_LOAD_PATH=/some/random/text:$GUILE_LOAD_PATH" mbc@HP8300:~/temp$ echo $GUILE_LOAD_PATH /home/mbc/.guix-profile/share/guile/site/3.0 At the end of .bashrc I see the last line is: export GUILE_LOAD_PATH=/some/random/text:/home/mbc/.guix-profile/share/guile/site/3.0 If I close and reopen the terminal and: mbc@HP8300:~$ echo $GUILE_LOAD_PATH /some/random/text:/home/mbc/.guix-profile/share/guile/site/3.0 So statement1 works as expected, modifying .bashrc which is then effective in modifying GUILE_LOAD_PATH on future invocations of terminal. statement2 is an attempt to modify the current running environment, but fails. Note that if I paste export GUILE_LOAD_PATH=/some/random/text:$GUILE_LOAD_PATH directly into the terminal, that successfully modifies the variable. Why does (system myvar) i.e. (system "export GUILE_LOAD_PATH=/some/random/text:$GUILE_LOAD_PATH") fail? Thanks Mortimer