处理循环的输出

    科技2025-10-01  28

    在使用循环语句时,如果想对输出内容进行处理,可在done后面进行操作,格式如下

    举例:想将输出内容保存在test.txt文件中,可在done后使用重定向命令

    for command

    do 

         commands

    done > test.txt

    举例:想在输出内容中进行查找"what"字符

    for command

    do 

         commands

    done | grep "what"

     

    Processed: 0.009, SQL: 8