Operating System - HP-UX
1832086 Members
2766 Online
110037 Solutions
New Discussion

swlist : version from gcc

 
Billa-User
Regular Advisor

swlist : version from gcc

hello,

i had to install GCC , i want to know with
swlist command the version of GCC.

how can i find out the version ?
can i use swlist and "Software Selections"?

swlist :

gcc 4.0.2 gcc

swlist -v -l fileset gcc.gcc-RUN

# Initializing...
# Contacting target "backup4"...
#
# swlist Installed Software Table of Contents
#
# For host: backup4:/
#
# Date: Wed Feb 22 07:56:15 2006
#

gcc.gcc-RUN
fileset
tag gcc-RUN
software_spec gcc.gcc-RUN,l=/usr/local,r=4.0.2,a=HP-UX_B.11.23_64
data_model_revision 2.40
instance_id 1
.
.


man swlist

Software Selections
swlist supports the following syntax for each software_selection:

bundle[.product[.subproduct][.fileset]][,version]

product[.subproduct][.fileset][,version]

+ The = (equals) relational operator lets you specify
selections with the following shell wildcard and pattern-
matching notations:

[ ], *, ?

+ Bundles and subproducts are recursive. Bundles can contain
other bundles and subproducts can contain other subproducts.

+ The \* software specification selects all products. Use this
specification with caution.

The version component has the form:

[,r revision][,a arch][,v vendor]
[,c category][,l=location][,fr revision]
[,fa arch]

+ location applies only to installed software and refers to
software installed to a location other than the default
product directory.


+ fr and fa apply only to filesets.

+ The (relational operator) component can be of the form:

=, ==, >=, <=, <, >, or !=

which performs individual comparisons on dot-separated
fields.

For example, r>=B.10.00 chooses all revisions greater than
or equal to B.10.00. The system compares each dot-separated
field to find matches.

+ The = (equals) relational operator lets you specify
selections with the shell wildcard and pattern-matching
notations:

[ ], *, ?, !

For example, the expression r=1[01].* returns any revision
in version 10 or version 11.

+ All version components are repeatable within a single
specification (e.g. r>=A.12, r components are used, the selection must match all
components.

+ Fully qualified software specs include the r=, a=, and v=
version components even if they contain empty strings. For
installed software, l= is also included.

+ No space or tab characters are allowed in a software
selection.

+ The software instance_id can take the place of the version
component. It has the form:

[instance_id]

within the context of an exported catalog, where instance_id
is an integer that distinguishes versions of products and
bundles with the same tag.

9 REPLIES 9
Arunvijai_4
Honored Contributor

Re: swlist : version from gcc

Hello,

You can use simply as, # swlist -l product gcc

It should provide you with all details.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: swlist : version from gcc

swlist | grep -i gcc


second field is version.

--
Muthu
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: swlist : version from gcc

or simply,

# what `which gcc`

--
Muthu
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: swlist : version from gcc

Hello,

# what `which gcc` may not give you proper details if it is downloaded from other sites than HP. Better way is,

# swlist -l product gcc

# gcc -V

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Asif Sharif
Honored Contributor

Re: swlist : version from gcc

Hi,
Use this command
#swlist | grep -i gcc

and for more information for swlist please go through this page.

http://docs.hp.com/en/B2355-90681/swlist.1M.html

Regards,
Asif Sharif
Regards,
Asif Sharif
Billa-User
Regular Advisor

Re: swlist : version from gcc


thx for your answers ,
now i typed following command, to get the version, but can i get with one swlist command the version , only to use awk, etc ?

# software_spec gcc.gcc-RUN,l=/usr/local,r=4.0.2,a=HP-UX_B.11.23_64

swlist -a software_spec -v -l fileset gcc.gcc-RUN | \
awk '$1 ~ /^software_spec$/ {
pos_revision=match($0,",r=")+3
pos_hpux=match($0,",a=")
len=pos_hpux-pos_revision
print substr($0,pos_revision,len)
}'
Arunvijai_4
Honored Contributor

Re: swlist : version from gcc

Hello,

This should be suffient,

# swlist -l product gcc |awk '{print $2}'

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: swlist : version from gcc

Are you going to use the gcc version in some other scripts? If you want to know the version the simply as,

# gcc -version
# gcc -V

will give the detials. or what `which gcc` for viewing.

Or with swlist as,

# swlist -l product gcc

To get the version then,

# swlist -l product gcc | awk '!/^#|^$/ { print $2; }'

--
Muthu
Easy to suggest when don't know about the problem!
Billa-User
Regular Advisor

Re: swlist : version from gcc

i have now enough informations , thx for the answers