开发者

Is Expect Scripts Still Worth Learning? [closed]

开发者 https://www.devze.com 2023-01-14 21:22 出处:网络
As it currently stands, 开发者_高级运维this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely so
As it currently stands, 开发者_高级运维this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

Is still worth learning expect? Because I have not seen any new books on this topic? What would anyone recommend for a good book on this?


expect is best used for controlling scripts that output queries and require a response. Many other languages struggle with this and create deadlocks on stdin/stdout when trying to use both. Expect also overcomes some issues with password entry (like when scripting SSH).

Having said that it isn't necessary to know expect because many other languages have an expect module (tcl and python come to mind) which provide the same behaviour.

I would have to say it depends on your job. If you spend a lot of time interacting with repetitive commandline scripts or FTP then expect is well worth adding to your scripting arsenal.


SpliFF wrote above about "... interacting with repetitive commandline script or FTP ..." While I'm all for automation, and regard Expect as indispensable, Expect is NOT necessary in 2010 for FTP or many other roles where it once was necessary. Fifteen years ago, for example, Expect was an appropriate way to automate FTP; now, most scripting languages already build in capabilities sufficient to replace Expect's use with FTP. Many, many automations can be done with what Perl, Python, Tcl, ... already build in, and Expect is not essential for these applications.


It never hurts to have another tool in your kit. Expect really does fill its niche extremely well.

The quintessential Expect book is Exploring Expect. It's the only Expect book you need.

0

精彩评论

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