|
From: Robbie M. <ro...@ac...> - 2011-03-22 10:37:43
|
Hello all
First up, thanks Vinod for your suggestion of a bash
wrapper script.
Please note the following corrections: exho is echo,
the OUT assignment (righthand-side) should be in
backticks (`) not single-quotes ('), --persist should
be -persist.
I reworked the original script and tested it on Linux
plus Gnuplot 4.2 patchlevel 6:
--- src begin / bash --------
#! /bin/bash
# usage message (optional)
case "$1" in
--help|--hel|--he|--h|-help|-hel|-he|-h|"-?")
SCRIPT=$(basename "$0")
echo " usage: $SCRIPT <gnuplot-cmds> create LOADFILE string
and load gnuplot-cmds file"
echo " $SCRIPT --help show this message and exit"
exit 0
;;
"")
SCRIPT=$(basename "$0")
echo "$SCRIPT: gnuplot file name required (try --help for usage)"
exit 2
esac
# active code
ARG1=$(basename "$1") # adapt these next two lines to
your needs
ARG1="$PWD/$ARG1"
echo "LOADFILE = \"$ARG1\"; load '$1'" | gnuplot -persist
----src end -----------------
And tested it with the following gnuplot code:
--- src begin / gnuplot -----
set title "source : " . LOADFILE # 'LOADFILE' is set by invoking
script
plot sin(x)
--- src end -----------------
best wishes
Robbie
---
> ------------------------------------------------------------
> To: gnu...@li...
> Subject: Re: [Gnuplot-info] name of current script
> Message-ID: <311...@ta...>
> From: vinodkgul <vin...@ya...>
> Date: Sun, 20 Mar 2011 08:00:39 -0700 (PDT)
> ------------------------------------------------------------
>
> 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.
>>
>> [snip - original posting]
---
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]
|