<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: To read the variable in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036209#M95246</link>
    <description>Hi Piotr:&lt;BR /&gt;&lt;BR /&gt;Based upon your questions, and without disrespect, you might find this shell overview helpful:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-90046/B2355-90046.pdf" target="_blank"&gt;http://docs.hp.com/en/B2355-90046/B2355-90046.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I would choose the Poxix shell since this is the HP-UX standard.  It aligns closely to the Korn shell and Bash (in the Linux world) is another cousin.&lt;BR /&gt;&lt;BR /&gt;A good site for shell scripts and techniques is also:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com/" target="_blank"&gt;http://www.shelldorado.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Mon, 26 Mar 2007 07:04:46 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2007-03-26T07:04:46Z</dc:date>
    <item>
      <title>To read the variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036205#M95242</link>
      <description>Hi there&lt;BR /&gt;I have variable set:&lt;BR /&gt;&lt;BR /&gt;LV=`vgdisplay -v vg00|awk '{if (/LV Name/) {split($3,a,/\//);printf "%s ",a[4]}}&lt;BR /&gt;'`&lt;BR /&gt;&lt;BR /&gt;echo $LV&lt;BR /&gt;&lt;BR /&gt;The output looks like that:&lt;BR /&gt;&lt;BR /&gt;lvol1 lvol2 lvol3 lvol4 lvol5 lvol6 lvol7 lvol8 &lt;BR /&gt;&lt;BR /&gt;I nead to read the variable contex, character by character so I can eventualy separate all names of lvols and count them.&lt;BR /&gt;&lt;BR /&gt;Perhaps there is a simplier method to count the hov many separate words are there?&lt;BR /&gt;&lt;BR /&gt;Regards &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Mar 2007 06:10:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036205#M95242</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2007-03-26T06:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: To read the variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036206#M95243</link>
      <description>Hey&lt;BR /&gt;&lt;BR /&gt;echo ${LV} | wc -w&lt;BR /&gt;&lt;BR /&gt;for more info check man wc&lt;BR /&gt;&lt;BR /&gt;to read each character do a for loop&lt;BR /&gt;&lt;BR /&gt;for i in ${LV} ; do&lt;BR /&gt;echo ${i}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Mon, 26 Mar 2007 06:17:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036206#M95243</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-03-26T06:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: To read the variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036207#M95244</link>
      <description>Hi,&lt;BR /&gt;how about :&lt;BR /&gt;&lt;BR /&gt;echo $LV | wc -w&lt;BR /&gt;&lt;BR /&gt;see "man wc"</description>
      <pubDate>Mon, 26 Mar 2007 06:17:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036207#M95244</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-03-26T06:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: To read the variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036208#M95245</link>
      <description>Hi,&lt;BR /&gt;  you can use wc command to do it with the switch -w.&lt;BR /&gt;&lt;BR /&gt;so in your script, add this line;&lt;BR /&gt;&lt;BR /&gt;echo $LV | wc -m&lt;BR /&gt;&lt;BR /&gt;From wc man;&lt;BR /&gt;   -m    Counts characters&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Prabu.S</description>
      <pubDate>Mon, 26 Mar 2007 06:41:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036208#M95245</guid>
      <dc:creator>Senthil Prabu.S_1</dc:creator>
      <dc:date>2007-03-26T06:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: To read the variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036209#M95246</link>
      <description>Hi Piotr:&lt;BR /&gt;&lt;BR /&gt;Based upon your questions, and without disrespect, you might find this shell overview helpful:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-90046/B2355-90046.pdf" target="_blank"&gt;http://docs.hp.com/en/B2355-90046/B2355-90046.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I would choose the Poxix shell since this is the HP-UX standard.  It aligns closely to the Korn shell and Bash (in the Linux world) is another cousin.&lt;BR /&gt;&lt;BR /&gt;A good site for shell scripts and techniques is also:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com/" target="_blank"&gt;http://www.shelldorado.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 26 Mar 2007 07:04:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036209#M95246</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-26T07:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: To read the variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036210#M95247</link>
      <description>Though the thread has been closed already,&lt;BR /&gt;but because no one mentioned the use of an array in this context.&lt;BR /&gt;You could slightly modify your assignment to&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;# set -A LV $(vgdisplay -v vg00|awk '/LV Name/{split($3,a,/\//);print a[4]}')&lt;BR /&gt; &lt;BR /&gt;# echo ${#LV[*]}&lt;BR /&gt;10&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Mar 2007 08:23:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036210#M95247</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2007-03-26T08:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: To read the variable</title>
      <link>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036211#M95248</link>
      <description>cool :)</description>
      <pubDate>Mon, 26 Mar 2007 08:32:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/to-read-the-variable/m-p/5036211#M95248</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2007-03-26T08:32:12Z</dc:date>
    </item>
  </channel>
</rss>

