Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Ethan Merritt Newsgroups: comp.graphics.apps.gnuplot Subject: Re: find piped to xargs gnuplot -c crashes Date: Wed, 5 Sep 2018 16:05:33 -0000 (UTC) Organization: A noiseless patient Spider Lines: 53 Message-ID: References: <5b8fd661$0$32244$e4fe514c@news.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 5 Sep 2018 16:05:33 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="ad5167444873d8f89ccf79215456bb31"; logging-data="10341"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zeRqdRk+inUGnpKGTUAtb" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:dQuoTOveFtpsSMw/2eOB0EVJAdI= Xref: csiph.com comp.graphics.apps.gnuplot:4034 On Wed, 05 Sep 2018 13:13:06 +0000, Alex van der Spek wrote: > I am trying to execute a gnuplot script on a large number of files found > by find like so: > > find . -name ??0rpm0?0rms.csv.bz2 | xargs gnuplot -c "xyz2plt.gp" > > This crashes on a signal 11. I do not know enough about xargs to explain exactly what is happening in this case. Let us suppose that the "find" command emits a sequence of filenames X1 X2 X3 X4 .... My understanding from the xargs man page is the it will construct a command sequence gnuplot -c "xyz2plt.gp" X1 X2 X3 ... XN gnuplot -c "xyz2plt.gp" XN+1 XN+2 XN+3 ... X2N ... where N is the number of filenames that fit in the command buffer without overflowing. > > The gnuplot script "xyz2plt.gp" contains only one line: > > print sprintf("%s %i %s", ARG0, ARGC, ARG1) > > Using a call instead of the -c option like so: > > find . -name ??0rpm0?0rms.csv.bz2 | xargs gnuplot -e 'call "xyz2plt.gp"' > > does not crash and gives the following output returned in the terminal: > > xyz2plt.gp 0 > > BZh91AY&SY��!���ۀ@ > ^ > "./24aug2018/400rpm050rms.csv.bz2", line 1: invalid character  > > Why does ARGC hold a 0, xargs adds the names of the files to the > commandline does it not? In this case ARGC holds a 0 because the command being executed is call "xyz2plt.gp" with no further arguments. Gnuplot will execute that command first before going back to the shell input to see if there are any more arguments. Ethan > Any help much appreciated. > Alex van der Spek