|
|
> Nicolas Alvarez wrote:
>>> ["This makes it read from a file. Unless the file is named '-', in
>>> which case it reads from stdin." OK, so how do I make it read from a
>>> file that's actually named '-' then? And other surprising ad-hoc
>>> behaviours...]
>>
>> ./-
>
> OK. But it now means that if you write a script that does this, you need
> to explicitly check whether the file you're going to process just
> happens to be called "-" and manually escape it if it is. And just
> think, if you didn't realise that, your script might be used for *years*
> before somebody tries to use it in that specific way and makes it crash
> spectacularly.
1. If the file is called -, you're calling for trouble anyway.
2. Whoever passes a filename to your script should be using the ./- thing.
Post a reply to this message
|
|