1. 1
    1. 1

      Coincidentally, I just saw this today: https://www.linuxjournal.com/content/put-down-pipe

      1. 1

        Is cat overused in CLI examples, especially in stack-overflow answers? Yes. Is the raw processing power consumed by cat going to negate your productivity? No. Are the clever work-arounds people invent to avoid using cat at all really worth it? Probably not, but it looks cooler than something more readable than just using cat…

        1. 1

          So, the example I was thinking of when I wrote this goes like so…

          Somebody on stack overflow wanted to generate passwords in bash, somebody suggested this solution:

          cat /dev/urandom | tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c 13  
          

          another user suggested this method to avoid using cat:

          </dev/urandom tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c 13  ; echo
          

          but I couldn’t make heads or tails of what was happening with </dev/urandom redirecting input or ; echo apparently doing something with the returned status? –

          So the question becomes, which is more readable? to me it’s the one with the (technically) unnecessary cat.