开发者

How to write eshell script?

开发者 https://www.devze.com 2023-02-09 10:12 出处:网络
there. I\'m new to eshell,and now i come to a problem that how can i script it. i\'ve tried (rm ~/somefile)

there. I'm new to eshell,and now i come to a problem that how can i script it. i've tried (rm ~/somefile) and it worked.so is every command like this?how should i write conditional code and loop?and what should i customize to make the system execute my script using eshell开发者_如何学编程 other than others ,like bash,by default? i'm not very good at english,and i hope you can understand what i mean.i'll also appreciate any correction to my english expression?


You can call any elisp command/function/operator from eshell; I suppose that means you can script it using elisp (See GNU Emacs Lisp Reference manual). Example:

Welcome to the Emacs shell

~ $ (defun foo (n) (if (= 0 (mod n 2)) "Even." "Odd!"))
foo
~ $ foo 2
Even.
~ $ foo 3
Odd!
~ $ 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号