|
From:
<br...@ph...> - 2006-05-23 18:08:28
|
Dave Denholm wrote: > I was pondering over somehow figuring it out from /proc/self but I've > not really come with anything. Unfortunately, if you invoke a subshell > to do any parsing, it will have a different /proc/self - I wonder if > the linux people have considered adding a /proc/pid/ppid soft-link to > the /proc entry of the parent ? That wouldn't help much, I think. He's trying to access the name of the script file currently being executed. That can be literally anywhere in the command line --- I don't see how anyhing in /proc could help finding that, expecially in cases like gnuplot -noraise -persist -mono foo.gpl bar.gpl baz.gpl How is 'bar.gpl' supposed to find its own name in this? If this is to work, it has to be done from inside gnuplot. I.e. there'll have to be a GPVAL_ that exports save_name from inside load_command() to the user. > Or perhaps a wrapper script which derives the filename from $1, stuffs > it into an env. variable (or opens a fixed fd for it) and execs the > real gnuplot ? Once you start writing scripts to run from outside gnuplot, I don't think there's much point actually looking at the filename of that script any more, because there no more any reason to establish a link between the name passed to gnuplot (which is, by definition, a script filename) and that of the datafile to be plotted. What's really missing here is not some shell voodoo, but a way of setting gnuplot user-defined variables by startup options, i.e. something like gnuplot -DNAME="foo.dat" foo.gpl If you're going to do that via a wrapper script, you might as well use an existing one, like http://www.phys.uni-paderborn.de/~stern/pl/ (also linked from our homepage). |