edit icon indicating copy to clipboard operation
edit copied to clipboard

On Linux `edit -?` creates a file named `-?`

Open zcobol opened this issue 8 months ago • 3 comments

Windows:

PS C:\Users\zcobol> edit -?
Error 0x8007007b: The filename, directory name, or volume label syntax is incorrect.
PS C:\Users\zcobol> edit -v
edit version 1.2.0

Linux:

zcobol@texas:~/bin$ ./edit -v
edit version 1.2.0
zcobol@texas:~/bin$ ./edit -?

Editor opens and file can be saved:

zcobol@texas:~/bin$ file ./'-?'
./-?: ASCII text

zcobol avatar Jun 15 '25 19:06 zcobol

That is normal behaviour, except that some command only accept arguments starting with a dash after --. So nano does the same as edit, but, vi doesn't.

pepa65 avatar Jun 18 '25 11:06 pepa65

I think it's worth trying to detect and reject invalid arguments though.

lhecker avatar Jun 18 '25 15:06 lhecker

As long as people are still able to edit the document called -? (or even -h for that matter), probably through edit -- -h (talking about Linux conventions here).

pepa65 avatar Jun 18 '25 15:06 pepa65