Why can we redirect the input of the less command, but we cannot work less without any arguments?

as far as I learned in programming, when I want to add input redirection to my program, I write my program, as when it is running, it waits for user input (using std :: cin or something like that). but I got confused in a smaller team.

We all know that we can do something like this:

ls -la | less

but when we try to execute

less

without any arguments we get an error. how did it happen ?!

+1
source share
2 answers

less accepts input from stdin or from a file.

( ), less, , , stdin ( isatty) .

. man 3 isatty

+3

- , UNIX , . , . , .

, . , . ?

+2

Source: https://habr.com/ru/post/1530144/


All Articles