I see. (I submitted the bug report.) I found that replacing $1 with $$1 causes the script to function correctly with gnuplot 5.4.0. I hope that future releases are subject to some set of standard regression tests.