|
From: Ethan M. <eam...@gm...> - 2026-02-26 19:36:28
|
Gnuplot uses the linux/unix convention that ~ (tilde) represents the user's
home directory.
This is taken from the environmental variable HOME on linux and USERPROFILE
on windows.
So
gnuplot> load "~/myscript.gp"
loads myscript.gp from the user's home directory.
gnuplot> set print "~/sub/output.txt"
gnuplot> print "# New script"
gnuplot> print "# that doesn't do anything"
gnuplot> unset output
will create and write to a new file in a subdirectory of the user's HOME
directory.
Ethan
On Thu, Feb 26, 2026 at 10:06 AM Alan <ala...@gm...> wrote:
> Thanks for helping to look for a workaround, but I do not think so.
>
> Too many different computers and people involved.
>
> Let me ask this differently.
> According to the manual (p.64), "The program then looks in the user’s HOME
> directory".
> So after launching, Gnuplot has already determined the location of the home
> directory.
> Is there any way to ask Gnuplot for its value (as a string)?
> If not, is there any reason for developers to avoid adding such a feature?
>
> Thanks, Alan
>
> On Thu, Feb 26, 2026 at 10:51 AM Peter Rockett <p.r...@sh...>
> wrote:
>
> > OK. Is the GNUPLOT_LIB environment variable what you need? Or the
> > .gnuplot & GNUPLOT.INI startup files?
> >
> > P.
> >
> > On 26/02/2026 14:12, Alan wrote:
> > > I would like to have data stored both
> > > relative to the script file and more importantly relative to the home
> > > directory,
> > > and I would like an easy way to find the data on multiple systems
> > > where the same relative relationships hold.
> > >
> > > Most important is being able to find the home directory
> > > in the gnuplot script in a system independent way.
> > > For example, I'd like my home and work computers
> > > to have an output folder that is fixed relative to the home directory,
> > > and I'd like Gnuplot to be able to find it without relying on `system`,
> > > which requires a different commands depending on the shell.
> > > (Powershell or cmd on Windows, vs zsh on Mac, vs bash or dash on Linux,
> > > etc.)
> > >
> > > Also desirable is for the script to be able to find data
> > > relative to the script's location, no matter what the
> > > current working directory from which Gnuplot is launched.
> > > As a simple example, suppose I am in folder `a` and do
> > > gnuplot ./gnuplot/myscript.gpi
> > > Then the pwd for Gnuplot becomes `a`, not the script directory.
> > > In the script, I'd like to ask Gnuplot for the script directory.
> > >
> > > Hope that's clearer, Alan
> > >
> > > On Thu, Feb 26, 2026 at 7:34 AM Peter Rockett via gnuplot-info <
> > > gnu...@li...> wrote:
> > >
> > >> Not totally clear of the objective here, but FWIW, you can specify a
> > >> path using "./abc/efg/hij" (i.e. using a forward slash) on both
> Windows
> > >> /and/ Unix/Linux, whereas Unix does not understand the '\' character
> in
> > >> this context. So the forward slash is system independent.
> > >>
> > >> P.
> > >>
> > >> On 25/02/2026 18:10, Alan wrote:
> > >>> Does Gnuplot offer a system independent way to
> > >>> create directory names relative to the home folder (especially)
> > >>> and also relative to the script folder?
> > >>>
> > >>> I am aware of `system`, but that depends on the OS shell.
> > >>> I'm not a C programmer, but I believe the tricks to retrieve this
> > >>> information in a system independent way are pretty standard. (?)
> > >>>
> > >>> Thank you.
> > >>>
> > >>> _______________________________________________
> > >>> gnuplot-info mailing list
> > >>> gnu...@li...
> > >>> Membership management via:
> > >> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
> > >> _______________________________________________
> > >> gnuplot-info mailing list
> > >> gnu...@li...
> > >> Membership management via:
> > >> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
> > >>
> > > _______________________________________________
> > > gnuplot-info mailing list
> > > gnu...@li...
> > > Membership management via:
> > https://lists.sourceforge.net/lists/listinfo/gnuplot-info
> >
>
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> Membership management via:
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
|