Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • If the folder is empty it prints ls's output and No output right after it. Is it normal? Commented Jul 5, 2021 at 19:01
  • 1
    What output do you get from ls when the folder is empty? It shouldn’t output anything, and then the above adds “No output” as a result... Commented Jul 5, 2021 at 20:52
  • Got it. I was trying ls | tee >([ $(wc -m) -gt 100 ] || echo some_output) on non-empty folder hoping to get on some_output output. But as I understand, if the folder is not empty, it will always print the ls output Commented Jul 5, 2021 at 22:44
  • Yes, this is an answer to your stated question, “Test if a command's output is an empty string”. Solving your other question about piping output to less if it’s too long is a different matter. Commented Jul 6, 2021 at 8:39