문제

What does the < symbol mean and when should I use it?

I understand > and >>.

Also, are there any other symbols like this?

도움이 되었습니까?

해결책

In most cases the result will be the same. The difference is:

  • with cat test you tell the cat program to open the file itself
  • with cat < test you tell the shell to open the file and feed it to cat

You could notice a difference in behavior for example when running a program with superuser priviledges. If your regular user can't access test file but superuser can, than:

  • sudo cat test will be able to print the file
  • sudo cat < test will not

This is because sudo causes cat to be run as superuser, but doesn't affect the shell's priviledges, so depending on whether cat or the shell is opening the file, this operation will succeed or fail.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top