[Thread Prev][Thread Next][Index]

Re: [ferret_users] Question about using script



On Tue, 22 Nov 2005, Ryo Furue wrote:

> Hello Ming,
> 
> | #!/bin/ksh -x
> | 
> | ferret<<EOF
> 
> It seems that the problem has something to do with how
> ferret reads the standard input.
> 
> I've confirmed that a short script like
> 
>    #!/bin/ksh
>    ferret<<EOF
>    set data "somedata.nc"
>    fill/k=1/l=1 var
>    quit
>    EOF
> 
> works.  I've also tested your script and reproduced your error
> messages.  I've also found
> 1) that when I have only two "set data . . . " lines, the script
>    works;
> 2) that a third "set data . . . " mangles ferret's output;
> 3) that even comment lines affect the results.
> 
> As to point (3), try add lines entirely consisting of "!" symbols
> like "!!!!!!!!!!!" and you'll see differences.
> 
> All these seem to point toward how ferret buffers and reads
> the standard input.
> 
> Ryo
> 

Hi Ryo & Ming,

This is an old problem, a system buffering issue in Linux.  A work-around
is to write a "wrapper.jnl" that just contains "GO script.jnl".  Then just
do "ferret -gif < wrapper.jnl".  See also

   http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_2004/msg00013.html

More details below. 

Andrew


23 Oct 2003
To Ferret Developers <contact_ferret@pmel.noaa.gov>
Re: Ferret for Linux, bug reading stdin

A user just came to me with a problem that sounded familiar: passing a
script to Linux Ferret via STDIN, e.g.

    ferret < test.jnl

doesn't work properly; if test.jnl is longer than 512 characters
(including newlines), Ferret skips the first 512 characters.

The mail archives have something on this:

http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_2001/msg00598.html
http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_2001/msg00600.html
http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_2001/msg00603.html

Brent had indicated that this might be a problem with readline in Linux.  
Is there a solution other than the -server option, which suppresses the
often useful MODE VERIFY?  Writing a sub-512byte "wrapper script" is a
workaround -- but since this problem is rather confusing for new users,
would it be possible to fix?

Thanks for your help,

Andrew



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement