ENV=$HOME/.kshrc export ENV doesn't work?

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Brent Holterma » Tue, 27 Jun 1995 04:00:00



A friend has observed the following behavior in his (AIX) .profile:
   ENV=$HOME/.kshrc export ENV
does not make ENV ($PATH) "stick" until after .profile completes.

The problem:  he invokes a user-menu from .profile (to preserve the
requisite "canned" user environment), and this menu depends upon some
of the (not yet set) ENV values.  Our VMS intuition suggests that the
global values should be set regardless of whether .profile has exited,
but this is obviously not the case.

Is there a simple way to circumvent this problem?

TIA for email responses.
--Brent
+----------------------------+----------------------------------+
|  Brent Holterman           |  phone:  206.685.2191            |

+----------------------------+----------------------------------+

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Dan Merc » Wed, 28 Jun 1995 04:00:00



: > A friend has observed the following behavior in his (AIX) .profile:
: >    ENV=$HOME/.kshrc export ENV
: > does not make ENV ($PATH) "stick" until after .profile completes.
: >
: > The problem:  he invokes a user-menu from .profile (to preserve the
: > requisite "canned" user environment), and this menu depends upon some
: > of the (not yet set) ENV values.

: It's best not to use "var=val cmd", unless you particularly want
: the semantics that it gives. It's more predictable to use
: "var=val; cmd" instead. In other words, export ENV in a
: separate command after you've set its value.

: steve
: --

: ISPs are responsible for maintaining the Information Superhighway. They
: are not responsible for how you drive.      #include <std_disclaimer.h>

This is totally bogus advice.  What he really nees to do is source
his .kshrc in his .profile - it doesn't get done automatically.

add:

 $ENV

after ENV=$HOME/.kshrc export ENV

--
Dan Mercer                                            ClearSystems, Inc

======================================================================
All opinions expressed are my own and do not reflect the opinions of
my employer or my employer's clients,  in particular 3M Company.
All advice or software offered or presented is provided As Is with no
warranty either expressed or implied.  Follow at your own risk.
Objects in the mirror are closer than they appear.

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Andrew A. Sen » Wed, 28 Jun 1995 04:00:00



Quote:extraordinaire writes:



|> : > A friend has observed the following behavior in his (AIX) .profile:
|> : >    ENV=$HOME/.kshrc export ENV
|> : > does not make ENV ($PATH) "stick" until after .profile completes.
|> : >
|> : > The problem:  he invokes a user-menu from .profile (to preserve the
|> : > requisite "canned" user environment), and this menu depends upon some
|> : > of the (not yet set) ENV values.
|>
|> : It's best not to use "var=val cmd", unless you particularly want
|> : the semantics that it gives. It's more predictable to use
|> : "var=val; cmd" instead. In other words, export ENV in a
|> : separate command after you've set its value.
|> : steve
|>
|> This is totally bogus advice.  What he really nees to do is source
|> his .kshrc in his .profile - it doesn't get done automatically.
|> add:
|>
|>  $ENV
|>
|> after ENV=$HOME/.kshrc export ENV

Wrong and wrong again.  This suggestion will *run* $ENV as it would run
anything else: in a sub-shell.  You never sourced it as you claim you have
to.  To do what you want, you would have to add:

    . $ENV

to .profile.  However, you DO NOT have to source this file, and yes, it
does get done automatically.

Below are selected sections from the ksh man page:
----------------------------------------------------------------------
         ENV  If this variable is set, then parameter  substitu-
              tion  is  performed  on  the value to generate the
              pathname of the script that will be executed  when
              the  shell  is  invoked.   (See Invocation below.)
              This file is typically used for alias and function
              definitions.
----------------------------------------------------------------------
  Invocation
     If the shell is invoked by exec(2), and the first  character
     of  argument zero ($0) is -, then the shell is assumed to be
     a login shell and commands are read  from  /etc/profile  and
     then  from  either  .profile  in  the  current  directory or
     $HOME/.profile, if either file exists.  Next,  commands  are
     read  from  the file named by performing parameter substitu-
     tion on the value of the environment  variable  ENV  if  the
     file exists.
----------------------------------------------------------------------
--
Drew Senko

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Steve_Kilba » Wed, 28 Jun 1995 04:00:00



Quote:> A friend has observed the following behavior in his (AIX) .profile:
>    ENV=$HOME/.kshrc export ENV
> does not make ENV ($PATH) "stick" until after .profile completes.

> The problem:  he invokes a user-menu from .profile (to preserve the
> requisite "canned" user environment), and this menu depends upon some
> of the (not yet set) ENV values.

It's best not to use "var=val cmd", unless you particularly want
the semantics that it gives. It's more predictable to use
"var=val; cmd" instead. In other words, export ENV in a
separate command after you've set its value.

steve
--

ISPs are responsible for maintaining the Information Superhighway. They
are not responsible for how you drive.      #include <std_disclaimer.h>

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Dan Merc » Thu, 29 Jun 1995 04:00:00



: : > A friend has observed the following behavior in his (AIX) .profile:
: : >    ENV=$HOME/.kshrc export ENV
: : > does not make ENV ($PATH) "stick" until after .profile completes.
: : >
: : > The problem:  he invokes a user-menu from .profile (to preserve the
: : > requisite "canned" user environment), and this menu depends upon some
: : > of the (not yet set) ENV values.

: : It's best not to use "var=val cmd", unless you particularly want
: : the semantics that it gives. It's more predictable to use
: : "var=val; cmd" instead. In other words, export ENV in a
: : separate command after you've set its value.

: : steve
: : --

: : ISPs are responsible for maintaining the Information Superhighway. They
: : are not responsible for how you drive.      #include <std_disclaimer.h>

: This is totally bogus advice.  What he really nees to do is source
: his .kshrc in his .profile - it doesn't get done automatically.

: add:

:  $ENV

ACK!! Where's the period.  Honest,  there was supposed to be a period:
 $ENV

Sorry.

: after ENV=$HOME/.kshrc export ENV

: --
: Dan Mercer                                            ClearSystems, Inc

: ======================================================================
: All opinions expressed are my own and do not reflect the opinions of
: my employer or my employer's clients,  in particular 3M Company.
: All advice or software offered or presented is provided As Is with no
: warranty either expressed or implied.  Follow at your own risk.
: Objects in the mirror are closer than they appear.

--
Dan Mercer                                            ClearSystems, Inc

======================================================================
All opinions expressed are my own and do not reflect the opinions of
my employer or my employer's clients,  in particular 3M Company.
All advice or software offered or presented is provided As Is with no
warranty either expressed or implied.  Follow at your own risk.
Objects in the mirror are closer than they appear.

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Dan Merc » Thu, 29 Jun 1995 04:00:00




Quote:: extraordinaire writes:



: |> : > A friend has observed the following behavior in his (AIX) .profile:
: |> : >    ENV=$HOME/.kshrc export ENV
: |> : > does not make ENV ($PATH) "stick" until after .profile completes.
: |> : >
: |> : > The problem:  he invokes a user-menu from .profile (to preserve the
: |> : > requisite "canned" user environment), and this menu depends upon some
: |> : > of the (not yet set) ENV values.
: |>
: |> : It's best not to use "var=val cmd", unless you particularly want
: |> : the semantics that it gives. It's more predictable to use
: |> : "var=val; cmd" instead. In other words, export ENV in a
: |> : separate command after you've set its value.
: |> : steve
: |>
: |> This is totally bogus advice.  What he really nees to do is source
: |> his .kshrc in his .profile - it doesn't get done automatically.
: |> add:
: |>
: |>  $ENV
: |>
: |> after ENV=$HOME/.kshrc export ENV

: Wrong and wrong again.  This suggestion will *run* $ENV as it would run
: anything else: in a sub-shell.  You never sourced it as you claim you have
: to.  To do what you want, you would have to add:

:     . $ENV

There was supposed to be a period there - notice the preceding space.
Vi betrayed me - me,  of all people.  And yes,  ENV does get sourced
automatically,  but not just by setting the value.  Read the post,
he's running a menu from .profile and expecting his .kshrc values to
be setup:
    "The problem:  he invokes a user-menu from .profile (to preserve the
    requisite "canned" user environment), and this menu depends upon some
    of the (not yet set) ENV values."

If you want your ENV values in your .profile,  you have to source it.

: to .profile.  However, you DO NOT have to source this file, and yes, it
: does get done automatically.

: Below are selected sections from the ksh man page:
: ----------------------------------------------------------------------
:          ENV  If this variable is set, then parameter  substitu-
:               tion  is  performed  on  the value to generate the
:               pathname of the script that will be executed  when
:               the  shell  is  invoked.   (See Invocation below.)
:               This file is typically used for alias and function
:               definitions.
: ----------------------------------------------------------------------
:   Invocation
:      If the shell is invoked by exec(2), and the first  character
:      of  argument zero ($0) is -, then the shell is assumed to be
:      a login shell and commands are read  from  /etc/profile  and
:      then  from  either  .profile  in  the  current  directory or
:      $HOME/.profile, if either file exists.  Next,  commands  are
:      read  from  the file named by performing parameter substitu-
:      tion on the value of the environment  variable  ENV  if  the
:      file exists.
: ----------------------------------------------------------------------
: --
: Drew Senko

--
Dan Mercer                                            ClearSystems, Inc

======================================================================
All opinions expressed are my own and do not reflect the opinions of
my employer or my employer's clients,  in particular 3M Company.
All advice or software offered or presented is provided As Is with no
warranty either expressed or implied.  Follow at your own risk.
Objects in the mirror are closer than they appear.

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Emmanuel GUY » Fri, 30 Jun 1995 04:00:00


: A friend has observed the following behavior in his (AIX) .profile:
:    ENV=$HOME/.kshrc export ENV
: does not make ENV ($PATH) "stick" until after .profile completes.

: The problem:  he invokes a user-menu from .profile (to preserve the
: requisite "canned" user environment), and this menu depends upon some
: of the (not yet set) ENV values.  Our VMS intuition suggests that the
: global values should be set regardless of whether .profile has exited,
: but this is obviously not the case.

: Is there a simple way to circumvent this problem?

As you use ENV, you use ksh and so, try this single command.
export ENV=$HOME/.kshrc

E.G.

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Dan Merc » Fri, 30 Jun 1995 04:00:00



: : A friend has observed the following behavior in his (AIX) .profile:
: :    ENV=$HOME/.kshrc export ENV
: : does not make ENV ($PATH) "stick" until after .profile completes.

: : The problem:  he invokes a user-menu from .profile (to preserve the
: : requisite "canned" user environment), and this menu depends upon some
: : of the (not yet set) ENV values.  Our VMS intuition suggests that the
: : global values should be set regardless of whether .profile has exited,
: : but this is obviously not the case.

: : Is there a simple way to circumvent this problem?

: As you use ENV, you use ksh and so, try this single command.
: export ENV=$HOME/.kshrc

: E.G.

You're missing the point - he's running a menu from a .profile and
needs the kshrc stuff there.  ENV won't be sourced until .profile
terminates.

--
Dan Mercer                                            ClearSystems, Inc

======================================================================
All opinions expressed are my own and do not reflect the opinions of
my employer or my employer's clients,  in particular 3M Company.
All advice or software offered or presented is provided As Is with no
warranty either expressed or implied.  Follow at your own risk.
Objects in the mirror are closer than they appear.

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Barry Margol » Sat, 01 Jul 1995 04:00:00



>You're missing the point - he's running a menu from a .profile and
>needs the kshrc stuff there.  ENV won't be sourced until .profile
>terminates.

Execute:

. $ENV

before running the menu.
--
Barry Margolin
BBN Planet Corporation, Cambridge, MA

Phone (617) 873-3126 - Fax (617) 873-5124

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Larry Gardn » Sat, 01 Jul 1995 04:00:00




: : : A friend has observed the following behavior in his (AIX) .profile:
: : :    ENV=$HOME/.kshrc export ENV
: : : does not make ENV ($PATH) "stick" until after .profile completes.

: : : The problem:  he invokes a user-menu from .profile (to preserve the
: : : requisite "canned" user environment), and this menu depends upon some
: : : of the (not yet set) ENV values.  Our VMS intuition suggests that the
: : : global values should be set regardless of whether .profile has exited,
: : : but this is obviously not the case.

: : : Is there a simple way to circumvent this problem?

: : As you use ENV, you use ksh and so, try this single command.
: : export ENV=$HOME/.kshrc

: : E.G.

: You're missing the point - he's running a menu from a .profile and
: needs the kshrc stuff there.  ENV won't be sourced until .profile
: terminates.

I think your missing the point.  Move the menu to the end of your .kshrc
file.  Then all the  setups  in .kshrc  can  happen  before  the menu is
invoked.

Of course this falls apart if your  expecting to set some  variables  to
change the  behavior  of the .kshrc  file.  But then if you need some of
the .kshrc  stuff to make these  changes your in a catch 22  predicament
anyway.  :)

: --
: Dan Mercer                                            ClearSystems, Inc

: ======================================================================
: All opinions expressed are my own and do not reflect the opinions of
: my employer or my employer's clients,  in particular 3M Company.
: All advice or software offered or presented is provided As Is with no
: warranty either expressed or implied.  Follow at your own risk.
: Objects in the mirror are closer than they appear.

Larry
--
        ______    _____________________________________________________________
       ____    /    ____________  Larry Gardner - IT Engineering Consultant __
      ___     /        ________  ISST - CCG  Workstation COE Group         __

    _       __  /  __  /  ___  US Mail: 20 Perimeter Summit Boulevard NE __
   __      /   /  /   /   __           Atlanta, GA  30319-1417          __
  ____   _/  _/  ____/   __  Comments are mine alone and not those of  __
 ______         /      ___  of my employer.                           __
____________  _/ ______________________________________________________

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Tony Porcz » Sat, 01 Jul 1995 04:00:00




>: You're missing the point - he's running a menu from a .profile and
>: needs the kshrc stuff there.  ENV won't be sourced until .profile
>: terminates.
>I think your missing the point.  Move the menu to the end of your .kshrc
>file.  Then all the  setups  in .kshrc  can  happen  before  the menu is
>invoked.

Bad advice.  What will happen when subshells are invoked?

t.

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Wally Beddo » Tue, 04 Jul 1995 04:00:00


What I do is add "export ENV=$HOME/.kshrc" in /etc/profile
This way the environment is set before the $HOME/.profile is executed.
Not sure if that answers your question.
(If you're running AIX, ROOT's shell is probably ksh)
--
Wally Beddoe                     Telekurs (North America) Inc.    


Semper Fi!
 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Dan Merc » Thu, 06 Jul 1995 04:00:00





: : : : A friend has observed the following behavior in his (AIX) .profile:
: : : :    ENV=$HOME/.kshrc export ENV
: : : : does not make ENV ($PATH) "stick" until after .profile completes.

: : : : The problem:  he invokes a user-menu from .profile (to preserve the
: : : : requisite "canned" user environment), and this menu depends upon some
: : : : of the (not yet set) ENV values.  Our VMS intuition suggests that the
: : : : global values should be set regardless of whether .profile has exited,
: : : : but this is obviously not the case.

: : : : Is there a simple way to circumvent this problem?

: : : As you use ENV, you use ksh and so, try this single command.
: : : export ENV=$HOME/.kshrc

: : : E.G.

: : You're missing the point - he's running a menu from a .profile and
: : needs the kshrc stuff there.  ENV won't be sourced until .profile
: : terminates.

: I think your missing the point.  Move the menu to the end of your .kshrc
: file.  Then all the  setups  in .kshrc  can  happen  before  the menu is
: invoked.

: Of course this falls apart if your  expecting to set some  variables  to
: change the  behavior  of the .kshrc  file.  But then if you need some of
: the .kshrc  stuff to make these  changes your in a catch 22  predicament
: anyway.  :)

The ENV file gets invoked anytime a shell is invoked,  i.e. all shell
scripts.  Might be dicey programming around that.

: : --
: : Dan Mercer                                            ClearSystems, Inc

: : ======================================================================
: : All opinions expressed are my own and do not reflect the opinions of
: : my employer or my employer's clients,  in particular 3M Company.
: : All advice or software offered or presented is provided As Is with no
: : warranty either expressed or implied.  Follow at your own risk.
: : Objects in the mirror are closer than they appear.

: Larry
: --
:         ______    _____________________________________________________________
:        ____    /    ____________  Larry Gardner - IT Engineering Consultant __
:       ___     /        ________  ISST - CCG  Workstation COE Group         __

:     _       __  /  __  /  ___  US Mail: 20 Perimeter Summit Boulevard NE __
:    __      /   /  /   /   __           Atlanta, GA  30319-1417          __
:   ____   _/  _/  ____/   __  Comments are mine alone and not those of  __
:  ______         /      ___  of my employer.                           __
: ____________  _/ ______________________________________________________

--
Dan Mercer                                            ClearSystems, Inc

======================================================================
All opinions expressed are my own and do not reflect the opinions of
my employer or my employer's clients,  in particular 3M Company.
All advice or software offered or presented is provided As Is with no
warranty either expressed or implied.  Follow at your own risk.
Objects in the mirror are closer than they appear.

 
 
 

ENV=$HOME/.kshrc export ENV doesn't work?

Post by Dan Merc » Thu, 06 Jul 1995 04:00:00



: >You're missing the point - he's running a menu from a .profile and
: >needs the kshrc stuff there.  ENV won't be sourced until .profile
: >terminates.

: Execute:

: . $ENV

: before running the menu.
: --
: Barry Margolin
: BBN Planet Corporation, Cambridge, MA

: Phone (617) 873-3126 - Fax (617) 873-5124

You're coming in late Barry.  That's the advice I already gave.

--
Dan Mercer                                            ClearSystems, Inc

======================================================================
All opinions expressed are my own and do not reflect the opinions of
my employer or my employer's clients,  in particular 3M Company.
All advice or software offered or presented is provided As Is with no
warranty either expressed or implied.  Follow at your own risk.
Objects in the mirror are closer than they appear.

 
 
 

1. PERL->$ENV{"DISPLAY"} doesn't work!

   If you have read my last post, then you understand my problem and what
I am trying to do, if not, please read it really quickly (Skim it).

I have discovered that in perl, there is an %ENV built in, but I can't get
it to work.

here is my command in perl:

   $ENV{"DISPLAY"} = "$machine:0.0";

  NOW, I notice that if I don't actually set the display at the command line,
then the DISPLAY variable doesn't show up when I type the command "env"  Thus
I wonder, if there is not DISPLAY variable in the %ENV in perl.

Does anyone know what's up . . . please let me know if you do.

Patrick

2. LIBRARY.

3. WANTED: Good .kshrc(.env) Shell Scripts

4. PICO: broken key-bindings? How to fix?

5. what does the env in "env name=value command" buy me?

6. problem in nis-makefile

7. Warm reboot for home Sparc or x86 (like TADPOLE's nomadic env.)

8. Safe to write HFS?

9. Referencing an env var from an env var

10. exporting env vars

11. how do I auto export env variables from a script?

12. exporting env. var. names with dollar ($)

13. Reading in ENV vars from a text file and exporting the value