#!/usr/local/bin/emacs -script

(let ((filename "/home/joneworlds/gopher/roophloch2023.txt")
                       (words (getenv "SEARCHREQUEST")))
       (with-current-buffer (find-file filename)
               (unless words (setq words "testing"))
               (goto-char (point-max))
               (setq buffer-read-only nil)
               (insert words)
               (newline)
               (goto-char (point-min))
               (setq fill-column 50)
               (fill-paragraph)
               (write-region (point-min) (point-max) filename))
       (princ "string received"))