![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Query result table display class 2008.06.08 (Default branch) | iBot | Software Releases - RSS News | 0 | 06-09-2008 12:40 PM |
| display the result of wc -l with words before and after the result | melanie_pfefer | UNIX for Dummies Questions & Answers | 3 | 04-30-2008 08:33 AM |
| display result from user input | thms_sum | Shell Programming and Scripting | 13 | 02-01-2008 05:34 AM |
| Search for a pattern from the result of search | boopathi_d | Shell Programming and Scripting | 3 | 12-05-2007 09:54 AM |
| Display result one page at a time | nickaren | UNIX for Dummies Questions & Answers | 4 | 09-10-2003 02:15 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hello all. I'm a long time browser, first time poster...Be gentle :-)
I don't use csh much, but have been asked to make a small script for our HP-UX systems to search for a report file(s) or summary file and display the result (I was using vuepad, but this probably is just complicating things) My latest error is <if: expression> after if ($type =="R".... I can't see what's wrong.. Can anyone help..? Here's the code. #!/usr/bin/csh set sumdir = ( /users/probe/buffer/summary/ ) set reportdir = ( /users/probe/buffer/reports/) printf "\n enter lot number, lower case, \n E.G. p260091p1 \n" set lot = $< printf "\n Report or Summary \n (R or S) \n ? " set type = $< if ( $type == "R" ) then type ="r" set files = ( `ls $reportdir | grep $lot ` ) endif if ( $type =="S" ) then $type ="s" set files = ( `ls $sumdir | grep $lot ` ) else printf "\n Type only R or S \n " endif set z = 1 printf "\nWHich file do you want to view?\n\n" while ($z <= $#files) printf "\tFILE %2d = %s\n" $z $files[$z] set z = $z + 1 end set last = $z - 1 printf "\nSelect (0-$last):" set choice = ($<) if ( $choice < 0 || $choice > $last ) then printf "No Such File.\n" goto END endif if ( $choice > 0 ) then set FILE = ( $files[$choice] ) else set FILE = ( $files ) endif foreach oneFILE ( $FILE ) if $file ="r" then /usr/vue/bin/vuepad $reportdir$oneFILE else /usr/vue/bin/vuepad $sumdir$oneFILE endif end END: #EOF |
|
||||
|
Why couldn't I see that..? I am just careless after writing so much code in langages that just don't care about these things..
My next sticky point is while ($z <= $#files) printf "\tFILE %2d = %s\n" $z $files[$z] set z = $z + 1 end Is the syntax for <while> ok? When executed I get ... files: Undefined Variable. |
![]() |
| Bookmarks |
| Tags |
| csh, csh arrays, unresolved |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|