From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.176.3.171 with SMTP id 40mr19219678uau.9.1483004546816; Thu, 29 Dec 2016 01:42:26 -0800 (PST) X-Received: by 10.157.11.142 with SMTP id 14mr1884078oth.20.1483004546775; Thu, 29 Dec 2016 01:42:26 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!d45no918632qta.0!news-out.google.com!g131ni3944itg.0!nntp.google.com!b123no4502345itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 29 Dec 2016 01:42:26 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:1205:c68c:9d90:a90b:4fd3:9106:2d29; posting-account=Pm0FhgoAAAAiPscNT3etSZ15tHNZGXm_ NNTP-Posting-Host: 2a02:1205:c68c:9d90:a90b:4fd3:9106:2d29 References: <35dadef7-2aee-4cd9-b774-ab54f4698d64@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Accessing Shell Variables From: ahlan.marriott@gmail.com Injection-Date: Thu, 29 Dec 2016 09:42:26 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:32972 Date: 2016-12-29T01:42:26-08:00 List-Id: On Wednesday, 28 December 2016 22:38:42 UTC+1, Victor Porton wrote: > Simon Wright wrote: > > > Victor Porton writes: > > > >> ahlan.marriott@gmail.com wrote: > >> > >>> I can access Windows, Linux and Osx environment variables using > >>> Ada.Environment_Variables.Value However Linux and Osx also have Shell > >>> variables. How can I access these? > >> > >> You cannot access a shell variable unless it is exported. Exported shell > >> variable becomes and environment variable: > >> > >> xxx=yyy > >> ./my-program # my-program cannot (at least in an easy way) access $xxx > >> > >> export xxx=yyy > >> # or > >> xxx=yyy > >> export xxx > >> ./my-program # my-program cannot access xxx environment variable > > > > This variant is the one that *can* access the environment variable. > > Yes, my typo. > > -- > Victor Porton - http://portonvictor.org Dear Victor, Thank you for your reply. I now understand (better) the difference between exported and non-exported shell variables. Exporting the shell variable I wanted to access solves the problem. Many thanks for answering my question ;-) Best wishes, Ahlan