Menu

#547 -e argument string ignores newlines with unhappy results

None
closed-rejected
nobody
None
5
4 days ago
2022-10-17
No

Applies to: gnuplot 5.4.5 (and all previous? also present in 5.2)
Linux - Ubuntu 20.04.5 LTS

The -e option does not accept newlines to separate commands., and it should.
This works:

$ gnuplot -persist -e "
    plot sin(x)
"

This does not:

$ gnuplot -persist -e "
    set xtics
    plot sin(x)
"
line -1: undefined variable: plot

This works:

$ gnuplot -persist -e "
    set xtics ;
    plot sin(x)
"

This does not:

$ gnuplot -persist -e "
    # this causes the entire script to be a comment
    set xtics ;
    plot sin(x)
"

I don't see why ignoring newlines in -e is a feature here. All the other commands I know use newlines as expected line separators in -e strings, e.g:

$ sed -ne '
    1p
    10p
    $p
' /etc/passwd

Please make newlines work as newlines inside -e strings, or if you're worried about backwards compatibility then add another option, say -E, that permits a proper script with newlines to be passed as a command line argument.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2022-10-17

    Ticket moved from /p/gnuplot/bugs/2555/

    Can't be converted:

    • _milestone:
    • _priority:
     
  • Ethan Merritt

    Ethan Merritt - 4 days ago
    • status: open --> closed-rejected
    • Group: -->
    • Priority: --> 5
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.