|
From: vinodkgul <vin...@ya...> - 2011-03-20 15:00:47
|
Hi, You can use the shell scrip As follows: 1st file--> gnuplot_file_print.sh exho $1 OUT='echo $1 | cut -d "." -f1' echo "set label 101 ' Path: `pwd` Filename : $OUT' ; load '$1' " |gnuplot --persist say test.gnu is the file containing the plot commands then from prompt use following : sh gnuplot_file_print.sh test.gnu Vinod Robbie Morrison wrote: > > > Hello all > > It would be rather useful if the current filename was > available from within a gnuplot script. > > This suggestion was raised in 2008 and 2009 > respectively: > > > http://groups.google.com/group/comp.graphics.apps.gnuplot/browse_thread/thread/2b34fa67a0365173/8f8c63c891f59aeb?lnk=gst&q=%22current+filename%22#8f8c63c891f59aeb > > http://groups.google.com/group/comp.graphics.apps.gnuplot/browse_thread/thread/781545ccfbaada56/ebffa12161a37fe3?lnk=gst&q=%22get+filename%22#ebffa12161a37fe3 > > And, AFAIK, has not been resolved. > > One approach might be: > > assume the file 'myfile.gp' contains the lines: > > myfile = GPVAL_LOAD_FILE > print "myfile = ", myfile > > then entering the command: > > load "myfile.gp" > > would display either of the following -- the first > being a simple echo and the second being the canonical > file path: > > myfile = myfile.gp > myfile = /path/to/myfile.gp > > On termination, GPVAL_LOAD_FILE would be unset. > > Another approach (probably too late) would have been > to have the 'call' command assign the filename to $0 > in line with most other shell positional variable > conventions. > > If there is a work-around, that would be good to know. > > best wishes > Robbie > --- > Robbie Morrison > PhD student -- policy-oriented energy system simulation > Technical University of Berlin (TU-Berlin), Germany > University email (redirected) : mor...@ie... > Webmail (preferred) : ro...@ac... > [from Webmail client] > > > > ------------------------------------------------------------------------------ > What You Don't Know About Data Connectivity CAN Hurt You > This paper provides an overview of data connectivity, details > its effect on application quality, and explores various alternative > solutions. http://p.sf.net/sfu/progress-d2d > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://old.nabble.com/name-of-current-script-tp31095884p31194288.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |