this post was submitted on 25 Oct 2023
1 points (100.0% liked)

Emacs

313 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

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.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here