|
From: Elias A. <eli...@if...> - 2012-08-22 07:14:07
|
Hi, I use gnuplot a lot, and in some quite different contexts, for which different settings are useful. So I tried putting shorthands like this in my .bashrc: alias gnuplot-a="gnuplot -e 'some commands;' -" alias gnuplot-b="gnuplot -e 'other commands;' -" (or, equivalently, "gnuplot init_file -"); the problem is that this puts gnuplot into batch mode and I cannot access the history, which kind of defeats the whole idea of saving keystrokes. Here are two threads that I found that deal with this problem: https://groups.google.com/d/topic/comp.graphics.apps.gnuplot/UGwZzqL84I8/discussion http://tech.groups.yahoo.com/group/info-gnuplot-beta/message/2929 In the first, someone had the same problem and suggested putting gnuplot in interactive mode when reading from '-' but got the reply: "The '-' command-line argument is meant for use with programs controlling gnuplot from the outside (after having loaded some scripts first), not for actual interactive usage by people." I understand that, but I really feel there should be a way to do what I am trying, be it with a command (e.g. 'load history' as suggested in the second thread above) or a switch (e.g. '--interactive'). Besides, gnuplot already treats an explicit '-' differently from no-arguments, and in the latter case seems to detect whether it is on a terminal: $ gnuplot # real interactive gnuplot> print 2*pi 6.28318530717959 gnuplot> $ echo print 2*pi | gnuplot # real batch 6.28318530717959 $ echo print 2*pi | gnuplot - # pseudo-interactive gnuplot> 6.28318530717959 gnuplot> So for '-', why not also check for a terminal and load the history in that case? At the same time, one could eliminate the prompts when not on a terminal. Or is there a solution I overlooked? After all, the threads are not exactly new. (I realize that I could fake it by writing a .gnuplot file on-the-fly, but that seems needlessly complicated and error-prone.) Sorry for the long post. Elias PS: Also, sorry if this is posted to the list more than once -- I had a problem where it was rejected at first, now I am no longer 100% sure if it got through before. |