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