It's confusing because the Unix-y side of IBM i seems nestled in arms of
the classic side.

In "real" Unix, the OS is a runtime env, device handler and task scheduler.
When a user logs in, a process is created and the shell chosen by/for that
user is launched. The shell is just a command interpreting program, a very
sophisticated one that amounts to a programming language in itself.

As the shell loads, it reads config files in a hierarchical order, the
user's own config files last and overriding anything that came before.

The commands in the green screen that change env vars for PASE / QSH
sessions effectively set those variables for shells as they launch, but
they can always be overridden in the particular user session, either in the
.profile (or .bashrc or .bash_profile) or subsequently by user manual
command entry or by scripts.

One trick that always traps the beginner: A script you execute from a Unix
shell runs in its own process, inheriting from the parent process, BUT not
writing back to it. If a script exports a variable, any command the script
calls (and any command THAT command calls, nesting down) gets the new
variable value. BUT when the script is done, the parent shell DOES NOT have
that new variable.

If you write a script to change the current shell's variables, you invoke
it with the source command, or dot (.) which is the same thing.

$ cat ./
EXPORT foo="bar"
echo $foo
$ ./
$ echo $foo

$ . ./
$ echo $foo

On Fri, Jan 4, 2019 at 11:14 AM Justin Taylor <JUSTIN@xxxxxxxxxxxxx> wrote:

Thanks guys. I thought it would be fine, but I've never overwritten an
IBM environment variable before. I wanted to be sure.

I have a Python package that can't handle POSIX time zones. Now I can try
changing the variable safe in the knowledge I won't break anything outside
my current session.

-----Original Message-----
From: Jack Woehr [mailto:jwoehr@xxxxxxxxxxxxxxxxxxxxxxxx]
Sent: Thursday, January 03, 2019 4:01 PM
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxx>
Subject: Re: [IBMiOSS] bash overwrite environment variable

This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: OpenSource-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

Help support by shopping at with our affiliate

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.