Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

AIX 6.1, setting env vars

Posted on 2011-09-21
4
Medium Priority
?
615 Views
Last Modified: 2013-11-17
I am trying to set an env var in AIX

I set the variable TEST, but it does not show up as being set

$ echo $TEST

$ set TEST=one
$
$ set
AUTHSTATE=files
........
_=TEST=one
$
$ echo $TEST

$ echo $PATH
/opt/IBM/mqsi/7.0/jre16/bin:/opt/IBM/mqsi/7.0/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/var/mqm/bin:/usr/bin/X11:/sbin:.

Open in new window


What does this line mean:

_=TEST=one

Open in new window


What am I doing wrong?

Thanks
0
Comment
Question by:Los Angeles1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 36575462
Hi,

the variable "_"  indicates the value of the parameter of the last set command issued.

It doesn't have any meaning for the actual environment (in a user's perspective).

Explanation: set is meant  to set positional parameters.

set TEST=one

will set the positional variable $1 to "TEST=one" (and $_, for that matter).

Check this with "echo $1"  and also "echo $_"

A special case is "set" when issued without any arguments. This displays the names and values of all KornShell variables, sorted by name.

Don't use "set" for defining variables.

Use just

VAR=value

for the current shell and

export VAR=value

for the current shell and its subshells (e.g. scripts called from the current shell).


wmp
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 36575500
Try this to make it (perhaps) a bit clearer:


set A B C

echo $1
echo $2
echo $3

echo $_

OK?


0
 

Author Closing Comment

by:Los Angeles1
ID: 36575567
Thanks, that was perfect.  Everything is working great, and I seet the $1, etc
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 36575577
>> doesn't have any meaning ... << 

It depends.

A net trick is using $_ to find the last field in a line.

Assume that you want to know the value of the 15 minute load average:

set $(uptime); echo $_

Not very common, but ...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question