<?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: Shell script:using a variable inside of a list in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889626#M704822</link>
    <description>Specify your list in double quotes rather than single quotes. Anything inside single quotes does not get expanded.</description>
    <pubDate>Fri, 04 Mar 2005 10:30:35 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2005-03-04T10:30:35Z</dc:date>
    <item>
      <title>Shell script:using a variable inside of a list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889625#M704821</link>
      <description>Hello all!&lt;BR /&gt;&lt;BR /&gt;I am writing a simple shell script that creates directories using a "for i in $list" loop. I decided to get fancy and I want to pass a value into the list, but it isn't working. Can someone help me out? When the script gets to the variable, it doesn't read in the value, it just tries to create /fs/dir/${var} instead of /fs/dir/blah.&lt;BR /&gt;&lt;BR /&gt;Here is a sample:&lt;BR /&gt;&lt;BR /&gt;echo "What hostname?"&lt;BR /&gt;read myhost&lt;BR /&gt;list='fs1 fs2 fs2/dir fs2/dir/${myhost}'&lt;BR /&gt;for i in $list&lt;BR /&gt;do&lt;BR /&gt; echo "\tChecking /$i structure...."&lt;BR /&gt; if [ -e "/${i}" ]&lt;BR /&gt;  then&lt;BR /&gt;     echo "\t\t/${i} exists! Moving On!"&lt;BR /&gt;  else&lt;BR /&gt;     echo "\t\t/${i} does not exist! Creating..."&lt;BR /&gt;     mkdir /${i}&lt;BR /&gt; fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Operating system: HP-UX 11.i&lt;BR /&gt;Shell: posix&lt;BR /&gt;&lt;BR /&gt;thanks is advance.&lt;BR /&gt;~Ed&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Mar 2005 10:27:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889625#M704821</guid>
      <dc:creator>Edward McCouch</dc:creator>
      <dc:date>2005-03-04T10:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script:using a variable inside of a list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889626#M704822</link>
      <description>Specify your list in double quotes rather than single quotes. Anything inside single quotes does not get expanded.</description>
      <pubDate>Fri, 04 Mar 2005 10:30:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889626#M704822</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-03-04T10:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script:using a variable inside of a list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889627#M704823</link>
      <description>Perhaps a better choice of words would be "instantiated" (to go from the abstract to the concrete) rather than "expanded" --- but you get the idea.</description>
      <pubDate>Fri, 04 Mar 2005 10:32:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889627#M704823</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-03-04T10:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script:using a variable inside of a list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889628#M704824</link>
      <description>Can it be that your qouting is wrong?&lt;BR /&gt;&lt;BR /&gt;Use backqoutes or in your case doubleqoutes will work, too.&lt;BR /&gt;&lt;BR /&gt;list="fs1 fs2 fs2/dir fs2/dir/${myhost}"&lt;BR /&gt;&lt;BR /&gt;Roland&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Mar 2005 10:36:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889628#M704824</guid>
      <dc:creator>RolandH</dc:creator>
      <dc:date>2005-03-04T10:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script:using a variable inside of a list</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889629#M704825</link>
      <description>That worked! Thank you!</description>
      <pubDate>Fri, 04 Mar 2005 10:36:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-a-variable-inside-of-a-list/m-p/4889629#M704825</guid>
      <dc:creator>Edward McCouch</dc:creator>
      <dc:date>2005-03-04T10:36:13Z</dc:date>
    </item>
  </channel>
</rss>

