|
From: Philipp K. J. <ja...@ie...> - 2026-02-26 19:45:30
|
On Thu, 26 Feb 2026 14:22:58 -0500 Alan <ala...@gm...> wrote: Have you checked out the built-in "pwd" command? > I believe (?) your suggestion is equivalent to using `system`, > so it is not a cross-platform solution. E.g., on Windows: > > gnuplot> print "`echo $HOME`" > $HOME > > (Note that $HOME is valid in PowerShell, but sadly > cmd remains the Windows default shell, and changing > that remains fraught.) > > > > On Thu, Feb 26, 2026 at 1:46 PM Michael Schuh < > Mic...@bo...> wrote: > > > How about this? > > > > michael@argon:~/tmp$ cat p.gnu > > home = "dogrun" > > print home > > home = "`echo $HOME`" > > print home > > > > > > michael@argon:~/tmp$ gnuplot p.gnu > > dogrun > > /home/michael > > > > 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 > >> > > > > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > Membership management via: > https://lists.sourceforge.net/lists/listinfo/gnuplot-info |