您就可以使用这些命令实验:
yes 0 | script -c 'ispell text.txt' /dev/null
或:
yes 1 | script -c 'aspell check text.txt' /dev/null
但请记住,结果甚至可以用于简单的事情是穷人:
$ echo The quik broown fox jmps over the laazy dogg > text.txt
$ yes 0 | script -c 'ispell text.txt' /dev/null
Script started, file is /dev/null
Script done, file is /dev/null
$ cat text.txt
The quick brown fox amps over the lazy dog
aspell似乎更糟糕,所以最好跟ispell一起去。
您需要script
命令,因为像ispell这样的命令不需要编写脚本。通常你会管的yes 0
输出到一个命令模拟撞击“0”键,所有的时间,但有些命令检测被脚本和拒绝合作:
$ yes 0 | ispell text.txt
Can't deal with non-interactive use yet.
幸运的,他们可以用script
命令被愚弄:
$ yes 0 | script -c 'ispell text.txt' /dev/null
Script started, file is /dev/null
Script done, file is /dev/null
您可以使用其他文件比的/ dev/null来记录输出:
$ yes 0 | script -c 'ispell text.txt' out.txt
Script started, file is out.txt
Script done, file is out.txt
$ cat out.txt
Script started on Tue 02 Feb 2016 09:58:09 PM CET
Script done on Tue 02 Feb 2016 09:58:09 PM CET
来源
2016-02-02 20:59:47
rsp
的GNU emacs拼写检查模式似乎符合这个要求,因为你可以replac e一次拼写出所有拼写错误。 –
那么,我必须在emacs中打开文件? – Hakim
是的,但只有一次。 –