Will it work if just replacing 2!:0 with 2!:1 ?
Чтв, 30 Дек 2010, Charles Turner писал(а):
> On Dec 30, 2010, at 2:58 PM, Don Guinn wrote:
>
> > If the purpose is to read the file if it exists, just go ahead and use fread
> > which will return _1 if the file does not exist. Just test for _1 after the
> > fread.
>
> On Dec 30, 2010, at 3:40 PM, Devon McCormick wrote:
>
> > Won't "fread" also return _1 for an existing file that cannot be read?
>
> Here is the "fixed" code in the gnuplot package:
>
> > NB. =========================================================
> > NB. following builds a shell script for running gnuplot
> > gphost=: 3 : 0
> > f=. jpath '~temp/shell.sh'
> > if. fexist f do. 1!:55 <f end.
> > y=. y, LF -. {:y
> > y 1!:2 <f
> > 'rwx------' 1!:7 <f
> > 2!:0 f
> > NB. If you delete shell.sh here, it's gone before it can execute
> > )
>
> The original author (ceb 2006, I believe) couldn't get this to work, and it
> was because (s)he did the sensible thing here:
>
> 1) create a temp file
> 2) write some data into it
> 3) change its permissions
> 4) execute it
> 5) delete it
>
> What seemed to be happening, in my case, at any rate, was that (5) would
> occur before (4) and there would be no shell script to execute gnuplot.
>
> So, not the most elegant fix, but I leave the file, and simply delete before
> writing the new one. I believe that delete returns an error if the file's not
> found, so I need to test for the first use, where the wouldn't be a file yet.
>
> As I said, none of this is very elegant, but it did get gnuplot to work on
> j701 on Darwin, which to me is preferable to GTK. Improvements to come...
>
> Best wishes, Charles
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm