× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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 ./chgvar.sh
EXPORT foo="bar"
echo $foo
$ ./chgvar.sh
bar
$ echo $foo

$ . ./chgvar.sh
bar
$ echo $foo
bar




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

yes
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/opensource
or email: OpenSource-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/opensource.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 by midrange.com 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.