One comment

  1. Just to let you know, both of those examples contain what is known as “useless uses of cat”. It shows bad coding practice for bash scripts, opening up more processes than are necessary. Google ‘useless uses of cat’ for more information on this common faux-pas.

    The following does the same, without the waste of a cat:


    while read line; do
    echo $line | rev
    done < file.txt

    #==========


    ls -1 | while read line
    do
    sed 's/foo/bar/g' < $line
    done

Leave a Reply

Your email address will not be published. Required fields are marked *