1751936 Members
4708 Online
108783 Solutions
New Discussion юеВ

Re: UNIX95

 
SOLVED
Go to solution
Shivkumar
Super Advisor

UNIX95

Dear Sirs,

What is the significance of UNIX95 while greping process ?

Thanks,
Shiv
6 REPLIES 6
Indira Aramandla
Honored Contributor
Solution

Re: UNIX95

Hi Siv,

UNIX95 is a variable or is a one line method to set a variable temporarily. UNIX95 variable is used to enable special features such as a hierarchical listing of parent or child programs, or to search for a program WITHOUT grep using ps
see man ps

IA
Never give up, Keep Trying
Muthukumar_5
Honored Contributor

Re: UNIX95

UNIX95 variable is used to use XPG4 namespace on greping process. Several options like -o are using with UNIX95 only.

UNIX95= ps -o pid,ppid
UNIX95= ps -A

-o option is giving several formats.

hth.
Easy to suggest when don't know about the problem!
Yogeeraj_1
Honored Contributor

Re: UNIX95

hi,

see also: http://docsrv.sco.com/DIFFS/UNIX95_Conformance.html
and
http://docs.hp.com/en/5965-4406/ch05s14.html

hope this helps!

regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Amit Agarwal_1
Trusted Contributor

Re: UNIX95

As you know, all the UNIX flavors have to obey the XPG4 standard, since they claim compliance with it. Sometimes it happens that the behavior of any command (say grep)as said by XPG4 is quite different from what it provides by default. Now to comply with standard, what these commands do is to provide the XPG4 behavior only if UNIX95 is set, else they provide their original behavior.

Sometimes, altogether they provide a new option only under UNIX95. This too is done to comply with XPG4.

-Amit
Bill Hassell
Honored Contributor

Re: UNIX95

AS mentioned, UNIX95 enables different behavior in certain commands, but also in certain system calls. For the ps command, the manpage shows several options that do not work without UNIX95 being set, specifically -o -H -C -A -G -U, of which the -o -H and -C options are the most useful. UNIX95 as a variable does not have any requirements, it just has to be defined so you may see UNIX95=1 or simply UNIX95=, both formats will define the variable.

You will most often see the assignment in front of a command such as:

UNIX95= ps -efH

and for POSIX shells, this is a temporary assignment that lasts only for the duration of the command (ps). While it is tempting to simply export UNIX95, DON'T DO IT! UNIX95 affects a lot of other commands and also library calls. Setting UNIX95 globally for your session may cause some programs to work differently. Since there is no index to the affected commands and calls, only set UNIX95 when you need it.

For ps, you can always set it without problems and gain the new options. The simplest way is to create an alias in .profile:

alias ps="UNIX95= /usr/bin/ps"

And now when you login, typing: ps -efH
will work just fine. Be sure to check out the -C option to eliminate grep from ps commands.


Bill Hassell, sysadmin
generic_1
Respected Contributor

Re: UNIX95

It allows you to easily sort out which proccess are taking up the most memory which can be very helpfull in tracing memory leaks and resource issues.
This is what I have found it most useful for.