[ale] scripts, file I/O, and loss of hair

Jim Kinney jim.kinney at gmail.com
Thu May 12 20:48:59 EDT 2011


On Thu, May 12, 2011 at 6:45 PM, The Don Lachlan <ale-at-ale.org@
unpopularminds.org> wrote:

> On Thu, May 12, 2011 at 05:57:42PM -0400, Jim Kinney wrote:
> > that expects a {binary name} < {input data file}. {input data file} is
> > variably named and often 20+MB. Changing {binary name} to work better is
> > political (think Fortran 77 base code - someone in charge got their PhD
> with
> > that program).
> > so things must work as they are with my little tweaks around the edges.
> > until I blow away the decades old mess and start over in C.
>
> That doesn't make any sense.
>
> If the Fortran code expects the data as a stream (that's what the redirect
> does), then why are you trying to get the file name in a shell script? What
> is your objective with this?
>

For logging the combination of which fortran binary with which input file
I'm simulating parts of a process with a shell script. The fortran code runs
for many hours.

FYI:

     shell variable redirect

fred='foo bar'
mary=`<${fred}`
-bash: ${fred}: ambiguous redirect

mary=`cat ${fred}`
cat: foo: No such file or directory
cat: bar: No such file or directory

    get contents of variable
mary=`echo ${fred}`
echo $mary
foo bar

    make a file
echo "foo bar" >> fred
mary=$(<$fred)
-bash: $fred: ambiguous redirect


   read file
cat fred
foo bar


    redirect file contents to shell variable
 mary=`<$fred`
-bash: $fred: ambiguous redirect


   create a reference (as shell var) to file to have redirect "go through"
john='fred'
mary=`<${john}`
echo $mary
foo bar


    or just 'cat' the damn thing and irritate R. Schwartz again :-)
suzy=$(cat ${john})
echo $suzy
foo bar

some days computers just suck.



> -L
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>



-- 
-- 
James P. Kinney III

As long as the general population is passive, apathetic, diverted to
consumerism or hatred of the vulnerable, then the powerful can do as they
please, and those who survive will be left to contemplate the outcome.
- *2011 Noam Chomsky*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20110512/ccc171c2/attachment.html 


More information about the Ale mailing list