<?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: what does the mean about $ in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557877#M837701</link>
    <description>$ is used in scripting to call a variable...&lt;BR /&gt;&lt;BR /&gt;Stf ;-)</description>
    <pubDate>Sat, 04 Jun 2005 06:28:49 GMT</pubDate>
    <dc:creator>Stf</dc:creator>
    <dc:date>2005-06-04T06:28:49Z</dc:date>
    <item>
      <title>what does the mean about $</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557876#M837700</link>
      <description>Hi,&lt;BR /&gt;  I often see the symbol "$" in some script:&lt;BR /&gt;PATH=${ORACLE_HOME}/bin:/sbin:/usr/bin:/usr/sbin:/etc:/bin&lt;BR /&gt;  what does the mean and what function about the $ ?&lt;BR /&gt;&lt;BR /&gt;thanks for your help</description>
      <pubDate>Sat, 04 Jun 2005 06:27:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557876#M837700</guid>
      <dc:creator>Rambo_1</dc:creator>
      <dc:date>2005-06-04T06:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: what does the mean about $</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557877#M837701</link>
      <description>$ is used in scripting to call a variable...&lt;BR /&gt;&lt;BR /&gt;Stf ;-)</description>
      <pubDate>Sat, 04 Jun 2005 06:28:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557877#M837701</guid>
      <dc:creator>Stf</dc:creator>
      <dc:date>2005-06-04T06:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: what does the mean about $</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557878#M837702</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;$ is a variable name identification used in shell.&lt;BR /&gt;&lt;BR /&gt;in shell: just VAR means list of characters. $VAR means variable&lt;BR /&gt;&lt;BR /&gt;if you say echo VAR, it will just print VAR. whereas if you say echo $VAR, it will print the contents of the variable VAR.&lt;BR /&gt;&lt;BR /&gt;I guess i explained more than enough&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 04 Jun 2005 06:34:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557878#M837702</guid>
      <dc:creator>Gopi Sekar</dc:creator>
      <dc:date>2005-06-04T06:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: what does the mean about $</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557879#M837703</link>
      <description>All of the above 100% correct.  But it goes a little deeper, and the $ prefix is more functional than has been explained.&lt;BR /&gt;&lt;BR /&gt;1 - variable concatination.&lt;BR /&gt;${ORACLE_HOME} this will evaluate that variable, say /home/oracle&lt;BR /&gt;${ORACLE_HOME}XXX This will evaluate ${ORACLE_HOME} &amp;amp; ADD XXX so, /home/oracleXXXX.&lt;BR /&gt;${ORACLE_HOME}/${MY_SCRIPTS} would concatanate the whole string to say, /home/Oracle/scripts/bin (assuming MY_SCRIPTS=scripts/bin).&lt;BR /&gt;&lt;BR /&gt;The reason for the curly brackets ${} is to explicitly define the variable.  e.g. you COULD have used $ORACLE_HOMEXXX . this would NOT work as there is no (well it is unlikley) to be a varable called "ORACLE_HOMEXXX".  The backets allow explicit variable concatination.&lt;BR /&gt;&lt;BR /&gt;2 - variable substitution.&lt;BR /&gt;Sometimes you want to read the result of a command into a variable e.g.&lt;BR /&gt;$TDAY --&amp;gt; todays date.&lt;BR /&gt;This can be done like so&lt;BR /&gt;export TDAY = $(date)&lt;BR /&gt;&lt;BR /&gt;Now $TDAY has todays date in it.  In effect the $(..cmd..) executes the command and presents it to the shell as a variable, (as opposed to standard error or standard out) so the following is equally valid (but trivial)&lt;BR /&gt;echo $(date)&lt;BR /&gt;&lt;BR /&gt;I fully admit that the above is trivial, but it can be useful in more complex scripts. Imagine that you wanted to print out all the logical volumes you have in vg01.  You can list all the logical volume names using vgdisplay -v vg01|grep "LV Name"; but this is not enough as you want ALL the info for each LV (without doing each one manually)... so&lt;BR /&gt;&lt;BR /&gt;for lv in $( /etc/vgdispalay -v vg01| perl -ane 'if (m/LV Name/) { print "$F[2] "})&lt;BR /&gt;do&lt;BR /&gt;/etc/lvdisplay $lv&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;IF you were not allowed to use the structure $( ..cmd.. ) then the only other way of doing this would be to output the above commands to a file &amp;amp; read it back into a for;do;done loop.  This would be slower as it needs to write the data to disks as opposed to doing the whole operation in memory.&lt;BR /&gt;&lt;BR /&gt;Anyway.. the $VAR; ${VAR}; and $( ..cmd.. ) structures are very useful..&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Tim</description>
      <pubDate>Sat, 04 Jun 2005 11:04:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557879#M837703</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2005-06-04T11:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: what does the mean about $</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557880#M837704</link>
      <description>The "$" symbol is used for variable expansion. For example you can set any variable (say ORACLE_HOME) to a string.&lt;BR /&gt;&lt;BR /&gt;# ORACLE_HOME=/opt/oracle/9.2.0&lt;BR /&gt;&lt;BR /&gt;now use this value in other variables or simply echo it at the command line&lt;BR /&gt;&lt;BR /&gt;#PATH=$ORACLE_HOME/bin:/sbin:/usr/sbin:/etc:/bin&lt;BR /&gt;&lt;BR /&gt;#echo $PATH&lt;BR /&gt;/opt/oracle/9.2.0/bin:/sbin:/usr/sbin:/etc:/bin&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Mon, 06 Jun 2005 14:07:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-does-the-mean-about/m-p/3557880#M837704</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-06-06T14:07:19Z</dc:date>
    </item>
  </channel>
</rss>

