help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Loops and scripting in eshell (was: Inject some eshell features into she


From: Oliver Scholz
Subject: Loops and scripting in eshell (was: Inject some eshell features into shell?)
Date: Sun, 19 Oct 2003 14:31:27 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (windows-nt)

Kai Grossjohann <kai.grossjohann@gmx.net> writes:

> Even though I now know how to do for loops in eshell, I was wondering
> if the following idea might be fun to play with.  Maybe someone has
> already done this and would like to share?
[...]

Loops are the one feature that I am missing in eshell. But rather than
adding the features I like to M-x shell, I'd prefer to enhance
eshell. [For purely religious reasons. I am very fond of eshell and,
moreover, I believe that the gods of editing will reward me for using
a shell that is implemented in Elisp.]

I sometimes use something like this:

(loop for f in (directory-files "." nil "\\w") do (rename-file f (concat f 
"x")))

on the eshell command line.

But for the simple stuff I need, I'd prefer the sh syntax:

for i in `ls` do ...

I know how to write a simple interpreter, but unfortunately I am not
familiar with eshell's internals. And I am actually a dummy as far as
shell scripting is concerned (I tend to use Elisp for
everything). And I don't want to spend much time on it right now.

So my questions are:

1. Is it the Right Way to get this by `defun'ing a function
   `eshell/for' which does the necessary parsing? The backquote stuff
   would probably be a problem, but I am not sure whether eshell
   actually provides a way to deal with it. Maybe I could take care
   of it myself. Thoughts?

2. Where can I get (comprehensive) documentation for the sh (bourne?)
   command syntax? I think, if it is feasible, I could as well make
   it decent enough to be worth a patch sent to the eshell
   maintainer.

    Oliver
-- 
28 Vendémiaire an 212 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]