This is a discussion on Scipting within the AIX Operating System forums, part of the Unix Operating Systems category; --> I'm trying to write a script to check version of filesets, however, when I run lslpp -l|grep krb5, it ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'm trying to write a script to check version of filesets, however, when I run lslpp -l|grep krb5, it shows multiple lines of the same output: root@rs239md03:lslpp -l|grep krb5 krb5.client.rte 1.4.0.4 COMMITTED Network Authentication Service krb5.client.samples 1.4.0.4 COMMITTED Network Authentication Service krb5.doc.en_US.html 1.4.0.4 COMMITTED Network Auth Service HTML krb5.doc.en_US.pdf 1.4.0.4 COMMITTED Network Auth Service krb5.lic 1.4.0.4 COMMITTED Network Authentication Service krb5.server.rte 1.4.0.4 COMMITTED Network Authentication Service krb5.toolkit.adt 1.4.0.4 COMMITTED Network Authentication Service krb5.client.rte 1.4.0.4 COMMITTED Network Authentication Service krb5.server.rte 1.4.0.4 COMMITTED Network Authentication Service when I try to script this to grab jsut that one variable (1.4.0.4) it grabs every instance: root@rs239md03:x=`lslpp -l|grep krb5 | awk '{print $2}'` root@rs239md03:echo $x 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 what I'm trying to do si modify the variable to grab just ONE instance of the version and save it to the variable.. root@rs239md03:echo $x 1.4.0.4 what do I need to do? thanks |
| |||
| KB wrote: > I'm trying to write a script to check version of filesets, however, > when I run lslpp -l|grep krb5, it shows multiple lines of the same > output: > > root@rs239md03:lslpp -l|grep krb5 > krb5.client.rte 1.4.0.4 COMMITTED Network > Authentication Service > krb5.client.samples 1.4.0.4 COMMITTED Network > Authentication Service > krb5.doc.en_US.html 1.4.0.4 COMMITTED Network Auth Service > HTML > krb5.doc.en_US.pdf 1.4.0.4 COMMITTED Network Auth Service > krb5.lic 1.4.0.4 COMMITTED Network > Authentication Service > krb5.server.rte 1.4.0.4 COMMITTED Network > Authentication Service > krb5.toolkit.adt 1.4.0.4 COMMITTED Network > Authentication Service > krb5.client.rte 1.4.0.4 COMMITTED Network > Authentication Service > krb5.server.rte 1.4.0.4 COMMITTED Network > Authentication Service > > when I try to script this to grab jsut that one variable (1.4.0.4) it > grabs every instance: > > root@rs239md03:x=`lslpp -l|grep krb5 | awk '{print $2}'` > root@rs239md03:echo $x > 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 > 1.4.0.4 > > what I'm trying to do si modify the variable to grab just ONE instance > of the version and save it to the variable.. > root@rs239md03:echo $x > 1.4.0.4 > > what do I need to do? > > thanks > It is not 'multiple lines of the same output'. It is one line per fileset with 'krb5' in the name (and potentially a root,usr,share part per fileset name). In your example all the *krb5* filesets are at the 1.4.0.4 level, but that is not guaranteed to always be true. If you just want the version from one fileset, do the lslpp query on that one fileset name and use the 'lslpp -O' flag to specify which fileset part to query. For example: lslpp -O u -l krb5.client.rte These flags are described in 'man lslpp'. Paul Landay |
| |||
| On Aug 2, 5:37 pm, Paul Landay <lan...@attglobal.net> wrote: > KB wrote: > > I'm trying to write a script to check version of filesets, however, > > when I run lslpp -l|grep krb5, it shows multiple lines of the same > > output: > > > root@rs239md03:lslpp -l|grep krb5 > > krb5.client.rte 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.client.samples 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.doc.en_US.html 1.4.0.4 COMMITTED Network Auth Service > > HTML > > krb5.doc.en_US.pdf 1.4.0.4 COMMITTED Network Auth Service > > krb5.lic 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.server.rte 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.toolkit.adt 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.client.rte 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.server.rte 1.4.0.4 COMMITTED Network > > Authentication Service > > > when I try to script this to grab jsut that one variable (1.4.0.4) it > > grabs every instance: > > > root@rs239md03:x=`lslpp -l|grep krb5 | awk '{print $2}'` > > root@rs239md03:echo $x > > 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 > > 1.4.0.4 > > > what I'm trying to do si modify the variable to grab just ONE instance > > of the version and save it to the variable.. > > root@rs239md03:echo $x > > 1.4.0.4 > > > what do I need to do? > > > thanks > > It is not 'multiple lines of the same output'. > It is one line per fileset with 'krb5' in the name > (and potentially a root,usr,share part per > fileset name). > > In your example all the *krb5* filesets are at > the 1.4.0.4 level, but that is not guaranteed > to always be true. > > If you just want the version from one fileset, > do the lslpp query on that one fileset name > and use the 'lslpp -O' flag to specify which > fileset part to query. For example: > lslpp -O u -l krb5.client.rte > These flags are described in 'man lslpp'. > > Paul Landay- Hide quoted text - > > - Show quoted text - I just want to print the vaule of $2 (which will be 1.4.0.4) and have a if statement to look at this variable. So far, it picks up all or nothing... x=`lslpp -l|grep krb5 | awk '{print $2}'` if [ $x = '1.4.0' ];then echo "$x Kerberos is installed on `hostname` " else echo "Kerberos needs to be installed on `hostname` " fi echo " " EOF done >$LF |
| |||
| On Aug 3, 10:01 am, KB <ucst...@hotmail.com> wrote: > I'm trying to write a script to check version of filesets, however, > when I run lslpp -l|grep krb5, it shows multiple lines of the same > output: > > root@rs239md03:lslpp -l|grep krb5 > krb5.client.rte 1.4.0.4 COMMITTED Network > Authentication Service > krb5.client.samples 1.4.0.4 COMMITTED Network > Authentication Service > krb5.doc.en_US.html 1.4.0.4 COMMITTED Network Auth Service > HTML > krb5.doc.en_US.pdf 1.4.0.4 COMMITTED Network Auth Service > krb5.lic 1.4.0.4 COMMITTED Network > Authentication Service > krb5.server.rte 1.4.0.4 COMMITTED Network > Authentication Service > krb5.toolkit.adt 1.4.0.4 COMMITTED Network > Authentication Service > krb5.client.rte 1.4.0.4 COMMITTED Network > Authentication Service > krb5.server.rte 1.4.0.4 COMMITTED Network > Authentication Service > > when I try to script this to grab jsut that one variable (1.4.0.4) it > grabs every instance: > > root@rs239md03:x=`lslpp -l|grep krb5 | awk '{print $2}'` > root@rs239md03:echo $x > 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 > 1.4.0.4 > > what I'm trying to do si modify the variable to grab just ONE instance > of the version and save it to the variable.. > root@rs239md03:echo $x > 1.4.0.4 > > what do I need to do? > > thanks Hi there I assume your question is "what version of Kerberos do I have installed?" I don't have Kerberos installed at all but this may help lslpp -lc sysmgt.websm* | awk -F':' '!/^#Fileset/{print $3}' | sort - nr | uniq just replace "sysmgt.websm*" with "krb5*" and see what you get. The "lsauthent" command may also be helpful. Found kerberos info' here http://publib.boulder.ibm.com/infoce...nformation.htm |
| |||
| KB wrote: > > I just want to print the vaule of $2 (which will be 1.4.0.4) and have > a if statement to look at this variable. So far, it picks up all or > nothing... > x=`lslpp -l|grep krb5 | awk '{print $2}'` > > if [ $x = '1.4.0' ];then > echo "$x Kerberos is installed on `hostname` " > else > echo "Kerberos needs to be installed on `hostname` " > fi > > echo " " > EOF > done >$LF > If your output could have more than one line use echo "$x" (with quote). next step is to determine which line you need. first line: echo "$x" | head -n 1 last line: echo "$x" | tail -n 1 3rd line: echo "$x" | head -n 3 | tail -n 1 (i am sure awk/sed/... could do that better) all lines: for I in "$x" do ; echo "my version $I"; done with best regards Dieter Stumpner |
| |||
| On Fri, 03 Aug 2007 09:09:12 +0200, Dieter Stumpner wrote: > KB wrote: >> >> I just want to print the vaule of $2 (which will be 1.4.0.4) and have a >> if statement to look at this variable. So far, it picks up all or >> nothing... >> x=`lslpp -l|grep krb5 | awk '{print $2}'` >> >> if [ $x = '1.4.0' ];then >> echo "$x Kerberos is installed on `hostname` " >> else >> echo "Kerberos needs to be installed on `hostname` " >> fi >> >> echo " " >> EOF >> done >$LF >> > If your output could have more than one line use echo "$x" (with quote). > > next step is to determine which line you need. first line: echo "$x" | > head -n 1 > last line: echo "$x" | tail -n 1 > 3rd line: echo "$x" | head -n 3 | tail -n 1 (i am sure awk/sed/... > could do that better) > all lines: for I in "$x" do ; echo "my version $I"; done > > with best regards > Dieter Stumpner Why not just use 'lslpp -lc'? |
| |||
| On Aug 2, 6:01 pm, KB <ucst...@hotmail.com> wrote: > I'm trying to write a script to check version of filesets, however, > when I run lslpp -l|grep krb5, it shows multiple lines of the same > output: > > root@rs239md03:lslpp -l|grep krb5 > krb5.client.rte 1.4.0.4 COMMITTED Network > Authentication Service > krb5.client.samples 1.4.0.4 COMMITTED Network > Authentication Service > krb5.doc.en_US.html 1.4.0.4 COMMITTED Network Auth Service > HTML > krb5.doc.en_US.pdf 1.4.0.4 COMMITTED Network Auth Service > krb5.lic 1.4.0.4 COMMITTED Network > Authentication Service > krb5.server.rte 1.4.0.4 COMMITTED Network > Authentication Service > krb5.toolkit.adt 1.4.0.4 COMMITTED Network > Authentication Service > krb5.client.rte 1.4.0.4 COMMITTED Network > Authentication Service > krb5.server.rte 1.4.0.4 COMMITTED Network > Authentication Service > > when I try to script this to grab jsut that one variable (1.4.0.4) it > grabs every instance: > > root@rs239md03:x=`lslpp -l|grep krb5 | awk '{print $2}'` > root@rs239md03:echo $x > 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 > 1.4.0.4 > > what I'm trying to do si modify the variable to grab just ONE instance > of the version and save it to the variable.. > root@rs239md03:echo $x > 1.4.0.4 > > what do I need to do? > > thanks what about lslpp -L then grep |
| |||
| On Aug 3, 2:59 pm, "aixd...@yahoo.com" <aixd...@yahoo.com> wrote: > On Aug 2, 6:01 pm, KB <ucst...@hotmail.com> wrote: > > > > > > > I'm trying to write a script to check version of filesets, however, > > when I run lslpp -l|grep krb5, it shows multiple lines of the same > > output: > > > root@rs239md03:lslpp -l|grep krb5 > > krb5.client.rte 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.client.samples 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.doc.en_US.html 1.4.0.4 COMMITTED Network Auth Service > > HTML > > krb5.doc.en_US.pdf 1.4.0.4 COMMITTED Network Auth Service > > krb5.lic 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.server.rte 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.toolkit.adt 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.client.rte 1.4.0.4 COMMITTED Network > > Authentication Service > > krb5.server.rte 1.4.0.4 COMMITTED Network > > Authentication Service > > > when I try to script this to grab jsut that one variable (1.4.0.4) it > > grabs every instance: > > > root@rs239md03:x=`lslpp -l|grep krb5 | awk '{print $2}'` > > root@rs239md03:echo $x > > 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 > > 1.4.0.4 > > > what I'm trying to do si modify the variable to grab just ONE instance > > of the version and save it to the variable.. > > root@rs239md03:echo $x > > 1.4.0.4 > > > what do I need to do? > > > thanks > > what about lslpp -L then grep- Hide quoted text - > > - Show quoted text - those all work, however, what I want to do is run this script enterprise wide and have it look for any kerberos version 1.4.x and if it's installed, say its running and if it's not installed, say install it. my script looks for that exact version of kerberos, however, if I'm running 1.4.0.2 or 1.4.0.3, it will give a error even when I'm looking for 1.4. HTH |
| ||||
| On Aug 3, 4:47 pm, KB <ucst...@hotmail.com> wrote: > On Aug 3, 2:59 pm, "aixd...@yahoo.com" <aixd...@yahoo.com> wrote: > > > > > On Aug 2, 6:01 pm, KB <ucst...@hotmail.com> wrote: > > > > I'm trying to write a script to check version of filesets, however, > > > when I run lslpp -l|grep krb5, it shows multiple lines of the same > > > output: > > > > root@rs239md03:lslpp -l|grep krb5 > > > krb5.client.rte 1.4.0.4 COMMITTED Network > > > Authentication Service > > > krb5.client.samples 1.4.0.4 COMMITTED Network > > > Authentication Service > > > krb5.doc.en_US.html 1.4.0.4 COMMITTED Network Auth Service > > > HTML > > > krb5.doc.en_US.pdf 1.4.0.4 COMMITTED Network Auth Service > > > krb5.lic 1.4.0.4 COMMITTED Network > > > Authentication Service > > > krb5.server.rte 1.4.0.4 COMMITTED Network > > > Authentication Service > > > krb5.toolkit.adt 1.4.0.4 COMMITTED Network > > > Authentication Service > > > krb5.client.rte 1.4.0.4 COMMITTED Network > > > Authentication Service > > > krb5.server.rte 1.4.0.4 COMMITTED Network > > > Authentication Service > > > > when I try to script this to grab jsut that one variable (1.4.0.4) it > > > grabs every instance: > > > > root@rs239md03:x=`lslpp -l|grep krb5 | awk '{print $2}'` > > > root@rs239md03:echo $x > > > 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 1.4.0.4 > > > 1.4.0.4 > > > > what I'm trying to do si modify the variable to grab just ONE instance > > > of the version and save it to the variable.. > > > root@rs239md03:echo $x > > > 1.4.0.4 > > > > what do I need to do? > > > > thanks > > > what about lslpp -L then grep- Hide quoted text - > > > - Show quoted text - > > those all work, however, what I want to do is run this script > enterprise wide and have it look for any kerberos version 1.4.x and if > it's installed, say its running and if it's not installed, say install > it. my script looks for that exact version of kerberos, however, if > I'm running 1.4.0.2 or 1.4.0.3, it will give a error even when I'm > looking for 1.4. HTH Try the following and hope that helps. x=`lslpp -l|grep krb5 | awk '{print $2}'|uniq` Thanks Dinakar |