[comp.unix.shell] Help with here; supplying data to interactive prgm

eesnyder@boulder.Colorado.EDU (Eric E. Snyder) (03/12/91)

This is my first post... hope this is the right place!

I am trying to write a script which supplies data to a number of 
interactive programs.  I have gotten this to work in the simplest
case but I need to be able to expand shell variables for input to
those programs.  

This works although it seems a but contrived:

#!/bin/csh -f
# This is a simple script to matchwater and ancillary programs
# a set of two files. File names are taken as command-line 
# arguments.   
#
echo 'preparing input files with splitwatpdb' 
foreach file ($argv[*])
	echo $file
	splitwatpdb << + 
$file.pdb
$file.pro
$file.wat
+
end 


The next program requires a loop to input the files since it requires
a couple of different files for each $file (ie .pro, .lcd, etc.). This
DOESN'T work and I which it did; there has got to be a better way!

echo 'finding lowest common denominator'
echo ''
# making here doc for lcd
echo $#argv > ~/tmp/lcd_args 
foreach file ($argv[*])
	echo $file.pro >> ~/tmp/lcd_args
	echo $file.lcd >> ~/tmp/lcd_args
	end
lcdpdbauto << ~/tmp/lcd_args



Any suggestions?
Thanks!
---------------------------------------------------------------------------
TTGATTGCTAAACACTGGGCGGCGAATCAGGGTTGGGATCTGAACAAAGACGGTCAGATTCAGTTCGTACTGCTG
Eric E. Snyder                            
Department of MCD Biology                    ...don't mind me,
University of Colorado, Boulder              I'm just a biologist!
Boulder, Colorado 80309-0347
LeuIleAlaLysHisTrpAlaAlaAsnGlnGlyTrpAspLeuAsnLysAspGlyGlnIleGlnPheValLeuLeu
---------------------------------------------------------------------------

rgupta@leland.Stanford.EDU (Rajesh Gupta) (03/15/91)

In article <eesnyder.668792553@beagle> eesnyder@boulder.Colorado.EDU (Eric E. Snyder) writes:
>This is my first post... hope this is the right place!
...
>
>
>The next program requires a loop to input the files since it requires
>a couple of different files for each $file (ie .pro, .lcd, etc.). This
>DOESN'T work and I which it did; there has got to be a better way!
>
>echo 'finding lowest common denominator'
>echo ''
># making here doc for lcd
>echo $#argv > ~/tmp/lcd_args 
>foreach file ($argv[*])
>	echo $file.pro >> ~/tmp/lcd_args
>	echo $file.lcd >> ~/tmp/lcd_args
>	end
>lcdpdbauto << ~/tmp/lcd_args
>
>
>
>Any suggestions?
>Thanks!

How about this:


#
echo # >! ~/tmp/junk
echo "lcdpdbauto << lend" >>  /tmp/junk
echo $# >> /tmp/junk
foreach file ($*)
	echo $file.pro >> 	/tmp/junk
	echo $file.lcd >> 	/tmp/junk
end
echo "lend" >> /tmp/junk
/bin/csh -f /tmp/junk
exit(0)



Rajesh


rgupta@sirius.stanford.edu