我可以管ispell的输出到一个数组中? [英] Can I pipe ispell output to an array?

查看:93
本文介绍了我可以管ispell的输出到一个数组中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以某种方式获得的ispell -l的输出到一个数组,这样我可以遍历他们。

I need to somehow get the output of ispell -l into an array so that I can loop through them..

到目前为止,香港专业教育学院得到这个

So far ive got this

cat $1 | ispell -l

我曾尝试按行读取他们行到一个数组但处理不当为我工作

I have tried to read them in line by line into an array but that hasnt worked for me

有什么建议?

推荐答案

它实际上比迄今提供的答案要容易得多。你并不需要调用任何外部的二进制文件,如或做任何环。

It's actually a lot easier than any answers provided thus far. You don't need to call any external binaries such as cat or do any loops.

简单地做:

array=( $(ispell -l < $1) )

这篇关于我可以管ispell的输出到一个数组中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆