Saturday 15 September 2012

unix - How do i examine the contents of a file named "-" (a single hyphen) on disk? -


I do not know how it got, and I want to know what's included in it. But every command I have tried, like cat - , cat \ - , vim - , vim \ - , Etc. Just start listening to STDIN

If the file name starts with a hyphen, then it . Give in your examples, cat./-/> code> or vim ./- / / code>. That is, the file named - , ./ in the current directory.

\ escapes the shell before executing it before cat or vim Parsed by. While the - filename is given special treatment by those programs, no shell, and the escape of the shell can not change the behavior of the program.

You do not need it to be the only file name - , but whenever it starts, because most programs will assume that this is a switch, some devices are special - Accept the argument which separates the switch with the file name, but it is not universal.

No comments:

Post a Comment