I want to write a script to process the contents of a text file line by line, and came across this example on Emacs wiki - https://www.emacswiki.org/emacs/BatchMode
emacs --batch --eval "(while t (print (eval (read))))"
So I adjusted it to emacs --batch --eval "(while t (print (read)))"
and the prompt Lisp expression:
is always displayed.
─○ emacs --batch --eval "(while t (print (read)))"
Lisp expression: fdfdfds
fdfdfds
Lisp expression: dsfdsfdfds
Lisp expression: ^C%
When I try a command like cat text1.txt | emacs --batch --eval "(while t (print (read)))"
it barfs completely, so read
is definitely not the function for this, unless I’m failing to pass some necessary options to it.
I made some progress, with
read-from-minibuffer
the function I need, however I want to terminate the script and suppress the error information at the end.