OverTheWire Bandit Level 1: How to Read a File Named With a Dash
OverTheWire Bandit Level 1 challenges players to read a password file whose name is a single dash (-), a deliberately tricky filename for beginners. Running 'cat -' does not work as expected because Unix tools conventionally interpret a bare dash as an instruction to read from standard input, causing the command to hang. The solution is to prefix the filename with './' — writing 'cat ./-' — which forces the shell to treat it as a literal file path rather than a special argument. Alternatively, using a double dash (--) before the filename achieves the same result on tools that support the end-of-options marker. This exercise introduces an important shell edge case: filenames that resemble command-line flags require explicit path notation to be handled correctly.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in