Menu

#2441 backtick evaluation not working in reload loop

None
closed-not-a-bug
nobody
None
2021-05-02
2021-04-30
No

gnuplot 5.2 patchlevel 8
I am trying to update the window title and / or plot title in a loop. It appears that in a while... loop some shell commands (date) don't refresh? I am trying to have the current date in a title, and also a part of a file (tail -1 datafile.dat) but neither seem to update in a loop according to the stdout print.

1 Attachments

Discussion

  • internationils

    internationils - 2021-04-30

    Running on Ubuntu 20.10

     
  • internationils

    internationils - 2021-04-30

    More debugging... apparently the backtick evaluation just does not seem to work in a while... loop, before it works fine when done multiple times with replot. In the loop, it evaluates correctly the first time but not on subsequent loops

    2021-04-30T12:49:06 CEST
    Looping...
    0.9 2021-04-30T12:49:06 CEST
    1.0 2021-04-30T12:49:11 CEST
    1.1 2021-04-30T12:49:17 CEST
    While-ing...
    1.2 2021-04-30T12:49:22 CEST
    1.3 2021-04-30T12:49:22 CEST
    1.4 2021-04-30T12:49:22 CEST
    
     
  • Ethan Merritt

    Ethan Merritt - 2021-04-30

    Correct. Substitution is done once, when the input line is first read. This is true for back-tick substitution and also macro expansion (@VARNAME). You can think of it as acting like the C language preprocessor. Once the substitution is made you can execute the code multiple times, for instance in a while loop, but that will not change the code that is being executed.

    If you need dynamic reevaluation, use the system("shell command") call instead.

     
  • Ethan Merritt

    Ethan Merritt - 2021-04-30
    • status: open --> open-not-a-bug
    • Group: -->
    • Priority: -->
     
  • internationils

    internationils - 2021-04-30

    Thanks, works now. Would be good to put that in the documentation, I didn't find it anywhere.
    See http://www.gnuplot.info/docs_5.4/Gnuplot_5_4.pdf p 234 under "while"
    Thanks!

     

    Last edit: internationils 2021-04-30
    • Ethan Merritt

      Ethan Merritt - 2021-04-30

      It's under substitution.

      Subtopics available for substitution:
          backquotes        macros            mixing_macros_backquotes
      
       When a command line to gnuplot is first read, i.e. before it is interpreted
       or executed, two forms of lexical substitution are performed. These are
       triggered by the presence of text in backquotes (ascii character 96) or
       preceded by @ (ascii character 64).
      
       
  • Ethan Merritt

    Ethan Merritt - 2021-05-02
    • status: open-not-a-bug --> closed-not-a-bug
     

Log in to post a comment.

MongoDB Logo MongoDB