<?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: CSH Scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465488#M774282</link>
    <description>Ron:&lt;BR /&gt;&lt;BR /&gt;I'm no csh expert, but I think I see the problem--you need to initialize ITEM[] like this:&lt;BR /&gt;&lt;BR /&gt;set ITEM=(YES NO MAYBE)&lt;BR /&gt;&lt;BR /&gt;As far as I can tell, that's the only way to initialize and fill an array with values in one step. And don't forget the '$' in '$ITEM[$COUNT]' when you 'echo' the results.&lt;BR /&gt;&lt;BR /&gt;I haven't even touched C shell in a long time. I'm just cheating by looking in my copy of _Unix_in_a_Nutshell_.</description>
    <pubDate>Fri, 17 Nov 2000 19:12:01 GMT</pubDate>
    <dc:creator>Kevin Ernst</dc:creator>
    <dc:date>2000-11-17T19:12:01Z</dc:date>
    <item>
      <title>CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465484#M774278</link>
      <description>Can anyone tell me how to define an array of items in a csh script and how to access them.&lt;BR /&gt;&lt;BR /&gt;This is what I tried:&lt;BR /&gt;ITEM[1]=YES&lt;BR /&gt;ITEM[2]=NO&lt;BR /&gt;ITEM[3]=MAYBE&lt;BR /&gt;&lt;BR /&gt;@ COUNT = 1&lt;BR /&gt;&lt;BR /&gt;echo "ITEM[$COUNT]&lt;BR /&gt;&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;the following is what is diplayed:&lt;BR /&gt;ITEM[1]=YES: No Match.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ron</description>
      <pubDate>Fri, 17 Nov 2000 18:22:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465484#M774278</guid>
      <dc:creator>Ron Bromwell</dc:creator>
      <dc:date>2000-11-17T18:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465485#M774279</link>
      <description>You have to define ITEM itself before you define ITEM[1] ITEM[2] etc.&lt;BR /&gt;&lt;BR /&gt;try&lt;BR /&gt;&lt;BR /&gt;set ITEM=PLACEHOLDER&lt;BR /&gt;set ITEM[1]=YES &lt;BR /&gt;set ITEM[2]=NO &lt;BR /&gt;set ITEM[3]=MAYBE &lt;BR /&gt;&lt;BR /&gt;set COUNT=1 &lt;BR /&gt;&lt;BR /&gt;echo "$ITEM[$COUNT]"&lt;BR /&gt;&lt;BR /&gt;good luck&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Nov 2000 19:00:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465485#M774279</guid>
      <dc:creator>Kofi ARTHIABAH</dc:creator>
      <dc:date>2000-11-17T19:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465486#M774280</link>
      <description>You can not do what you would like in C-shell.  C-shell only supports unary variables.  So &lt;BR /&gt;set var[1]="yes"&lt;BR /&gt;However,  try and set var[2] and see what you get.  It should be something like...&lt;BR /&gt;"set: Subscript out of range.".&lt;BR /&gt;In order to use arrays, you need to use Korne or Borne shell.&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;Shannon</description>
      <pubDate>Fri, 17 Nov 2000 19:03:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465486#M774280</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2000-11-17T19:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465487#M774281</link>
      <description>Your answer is below:&lt;BR /&gt;I want 10 points!&lt;BR /&gt;&lt;BR /&gt; % make love&lt;BR /&gt; Make: Don't know how to make love. Stop.&lt;BR /&gt;&lt;BR /&gt; % got a light?&lt;BR /&gt; No match.&lt;BR /&gt;&lt;BR /&gt; % sleep with me&lt;BR /&gt; bad character&lt;BR /&gt;&lt;BR /&gt; % man: Why did you get a divorce?&lt;BR /&gt; man:: Too many arguments.&lt;BR /&gt;&lt;BR /&gt; % rm God&lt;BR /&gt; rm: God nonexistent&lt;BR /&gt;&lt;BR /&gt; % make 'heads or tails of all this'&lt;BR /&gt; Make: Don't know how to make heads or tails of all this. Stop.&lt;BR /&gt;&lt;BR /&gt; % make sense&lt;BR /&gt; Make: Don't know how to make sense. Stop.&lt;BR /&gt;&lt;BR /&gt; % make mistake&lt;BR /&gt; Make: Don't know how to make mistake. Stop.&lt;BR /&gt;&lt;BR /&gt; % make bottle.open&lt;BR /&gt; Make: Don't know how to make bottle.open. Stop.&lt;BR /&gt;&lt;BR /&gt; % \(-&lt;BR /&gt; (-: Command not found.&lt;BR /&gt;&lt;BR /&gt; % rm -i God&lt;BR /&gt; rm: remove God? y&lt;BR /&gt; % ls God&lt;BR /&gt; God not found&lt;BR /&gt; % make light&lt;BR /&gt; Make: Don't know how to make light. Stop.&lt;BR /&gt;&lt;BR /&gt; % date me&lt;BR /&gt; You are not superuser: date not set&lt;BR /&gt; Thu Aug 25 15:52:30 PDT 1988&lt;BR /&gt;&lt;BR /&gt; % man rear&lt;BR /&gt; No manual entry for rear.&lt;BR /&gt;&lt;BR /&gt; % If I had a ) for every dollar Reagan spent, what would I have?&lt;BR /&gt; Too many )'s.&lt;BR /&gt;&lt;BR /&gt; % * How would you describe George Bush&lt;BR /&gt; *: Ambiguous.&lt;BR /&gt;&lt;BR /&gt; % %Vice-President&lt;BR /&gt; %Vice-President: No such job.&lt;BR /&gt;&lt;BR /&gt; % ls Meese-Ethics&lt;BR /&gt; Meese-Ethics not found&lt;BR /&gt;&lt;BR /&gt; % "How would you rate Reagan's senility?&lt;BR /&gt; Unmatched ".&lt;BR /&gt;&lt;BR /&gt; % [Where is Jimmy Hoffa?&lt;BR /&gt; Missing ].&lt;BR /&gt;&lt;BR /&gt; % ^How did the^sex change operation go?&lt;BR /&gt; Modifier failed.&lt;BR /&gt;&lt;BR /&gt; % cp /dev/null sex;chmod 000 sex&lt;BR /&gt; % more sex&lt;BR /&gt; sex: Permission denied&lt;BR /&gt; % mv sex show&lt;BR /&gt; % strip show&lt;BR /&gt; strip: show: Permission denied&lt;BR /&gt;&lt;BR /&gt; % who is my match?&lt;BR /&gt; No match.&lt;BR /&gt;&lt;BR /&gt; % set i="Democratic_Platform";mkdir $i;chmod 000 $i;ls $i&lt;BR /&gt; Democratic_Platform unreadable&lt;BR /&gt;&lt;BR /&gt; % awk "Polly, the ship is sinking"&lt;BR /&gt; awk: syntax error near line 1&lt;BR /&gt; awk: bailing out near line&lt;BR /&gt;&lt;BR /&gt; % %blow&lt;BR /&gt; %blow: No such job.&lt;BR /&gt;&lt;BR /&gt; % 'thou shalt not commit adultery'&lt;BR /&gt; thou shalt not commit adultery: Command not found.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Nov 2000 19:05:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465487#M774281</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2000-11-17T19:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465488#M774282</link>
      <description>Ron:&lt;BR /&gt;&lt;BR /&gt;I'm no csh expert, but I think I see the problem--you need to initialize ITEM[] like this:&lt;BR /&gt;&lt;BR /&gt;set ITEM=(YES NO MAYBE)&lt;BR /&gt;&lt;BR /&gt;As far as I can tell, that's the only way to initialize and fill an array with values in one step. And don't forget the '$' in '$ITEM[$COUNT]' when you 'echo' the results.&lt;BR /&gt;&lt;BR /&gt;I haven't even touched C shell in a long time. I'm just cheating by looking in my copy of _Unix_in_a_Nutshell_.</description>
      <pubDate>Fri, 17 Nov 2000 19:12:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465488#M774282</guid>
      <dc:creator>Kevin Ernst</dc:creator>
      <dc:date>2000-11-17T19:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465489#M774283</link>
      <description>#!/bin/csh -f&lt;BR /&gt;&lt;BR /&gt;set count = 1&lt;BR /&gt;set ITEM = (yes no maybe)&lt;BR /&gt;&lt;BR /&gt;while ( $count &amp;lt; '4')&lt;BR /&gt;echo "ITEM["$count"]="$ITEM[$count]&lt;BR /&gt;@ count = $count + 1&lt;BR /&gt;end&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Here is the output:&lt;BR /&gt;ITEM[1]=yes&lt;BR /&gt;ITEM[2]=no&lt;BR /&gt;ITEM[3]=maybe&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Nov 2000 19:20:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465489#M774283</guid>
      <dc:creator>Tony Vilardi</dc:creator>
      <dc:date>2000-11-17T19:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465490#M774284</link>
      <description>Kofi, I tried that method before posting with both 'csh' and 'tcsh' and got  'set: Subscript out of range.' I think that doesn't work because ITEM is initialized to have exactly one element (set ITEM=PLACEHOLDER), and you can't extend it after the fact.</description>
      <pubDate>Fri, 17 Nov 2000 19:21:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465490#M774284</guid>
      <dc:creator>Kevin Ernst</dc:creator>
      <dc:date>2000-11-17T19:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465491#M774285</link>
      <description>Shannon:&lt;BR /&gt;&lt;BR /&gt;Regular *Bourne* shell doesn't support arrays (but the POSIX shell does); C shell, as far as I know, has always had arrays:&lt;BR /&gt;&lt;BR /&gt;batwing 21: set ITEM=(YES NO MAYBE)&lt;BR /&gt;batwing 22: echo $ITEM[1]&lt;BR /&gt;YES&lt;BR /&gt;batwing 23: echo $ITEM[2]&lt;BR /&gt;NO&lt;BR /&gt;batwing 24: echo $ITEM[3]&lt;BR /&gt;MAYBE&lt;BR /&gt;batwing 25: &lt;BR /&gt;</description>
      <pubDate>Fri, 17 Nov 2000 19:27:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465491#M774285</guid>
      <dc:creator>Kevin Ernst</dc:creator>
      <dc:date>2000-11-17T19:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465492#M774286</link>
      <description>Thanks all,&lt;BR /&gt;set ITEMS = (one two three) &lt;BR /&gt;&lt;BR /&gt;worked.&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;Ron&lt;BR /&gt;&lt;BR /&gt;Anyone know of a good books on UNIX scripting?</description>
      <pubDate>Fri, 17 Nov 2000 19:30:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465492#M774286</guid>
      <dc:creator>Ron Bromwell</dc:creator>
      <dc:date>2000-11-17T19:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465493#M774287</link>
      <description>I almost hate to add yet *another* shameless (but not commerically-motivated) plug for O'Reilly (like they need any help), but the O'Reilly 'Nutshell' series are just tops. I always keep my copy of _UNIX_in_a_Nutshell_ (ISBN: 1-56592-001-5) nearby. I use the section on the Bourne/Korn shells to check the syntax on the builtins when I get rusty. Makes a handy regexp, sed, awk, and vi reference, too!&lt;BR /&gt;&lt;BR /&gt;I would imagine HP's "Shells: User's Guide" (viewable at &lt;A href="http://docs.hp.com" target="_blank"&gt;http://docs.hp.com&lt;/A&gt; in HTML or PDF format) would be a pretty good place to start, too.</description>
      <pubDate>Fri, 17 Nov 2000 20:17:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465493#M774287</guid>
      <dc:creator>Kevin Ernst</dc:creator>
      <dc:date>2000-11-17T20:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465494#M774288</link>
      <description>Yeah, I ooopsed!  Sorry about that.  I did some digging, and the array size has to be set first.&lt;BR /&gt;set CAR = ( 1 2 3 4 5 6 7 8 9 10 )&lt;BR /&gt;will give you a 10 number array.&lt;BR /&gt;echo $CAR &lt;BR /&gt;1 2 3 4 5 6 7 8 9 10&lt;BR /&gt;echo $#CAR&lt;BR /&gt;10&lt;BR /&gt;then you can define the indivuduals.&lt;BR /&gt;&lt;BR /&gt;Sorry again for answering in haste.  C-shell is a pain in the #$%^&amp;amp;* for scripting, so I quit using it a couple of years ago.  Functions are so much nicer in Borne&amp;amp;Korn :)&lt;BR /&gt;&lt;BR /&gt;Sincerely,&lt;BR /&gt;Shannon</description>
      <pubDate>Fri, 17 Nov 2000 20:22:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465494#M774288</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2000-11-17T20:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465495#M774289</link>
      <description>Yeah, I actually saw the venerable Bill Hassell make a small comment along those lines in another recent post:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0xbb5e7e990647d4118fee0090279cd0f9,00.html" target="_blank"&gt;http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0xbb5e7e990647d4118fee0090279cd0f9,00.html&lt;/A&gt;</description>
      <pubDate>Fri, 17 Nov 2000 22:56:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465495#M774289</guid>
      <dc:creator>Kevin Ernst</dc:creator>
      <dc:date>2000-11-17T22:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465496#M774290</link>
      <description>Me, I've lately become a Bourne-shell junkie. =)</description>
      <pubDate>Fri, 17 Nov 2000 22:58:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465496#M774290</guid>
      <dc:creator>Kevin Ernst</dc:creator>
      <dc:date>2000-11-17T22:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: CSH Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465497#M774291</link>
      <description>You have to initialize a variable as array first.&lt;BR /&gt;&lt;BR /&gt;set x = ()&lt;BR /&gt;&lt;BR /&gt;Sets this variable x as an array. You can then fill it. If you would like to use a loop or anything you can do something like:&lt;BR /&gt;&lt;BR /&gt;set x = ($x $newval)&lt;BR /&gt;&lt;BR /&gt;As mentioned in the previous posts you can set and fill this array in one step. Also you can always add new fields to the array. But you can't put in emty spots. Every field has to contain something.</description>
      <pubDate>Mon, 20 Nov 2000 07:17:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/csh-scripting/m-p/2465497#M774291</guid>
      <dc:creator>Stefan Schulz</dc:creator>
      <dc:date>2000-11-20T07:17:42Z</dc:date>
    </item>
  </channel>
</rss>

