如何一次仅打印或显示文本文件中的单词。当我运行我的脚本时,它应该只一个一个地显示文本文件中的每个单词,但只显示那个单词。
这是我所做的,但它将每个单词显示在单独的行上,但它显示了所有单词:
FS=$'\n'
for j in `cat read`
do
echo "$j"
done
Run Code Online (Sandbox Code Playgroud)
我希望输出看起来像这样:
root@matrix:~> first word ---> this word disappear when second is displayed
root@matrix:~> second word ---> this disappear when third is displayed
root@matrix:~> third word ---> this disappear when fourth is displayed and continues like this to the end of the file!
Run Code Online (Sandbox Code Playgroud)