What characters should be restricted from a Unix file name?

后端 未结 7 621
闹比i
闹比i 2020-12-02 14:56

Consider a Save As dialog with a free text entry where the user enters a file name as free text, then clicks a Save button. The software t

相关标签:
7条回答
  • 2020-12-02 16:00

    Although the accepted answer might have truth I think there's a benefit to having some restrictions that could be potentially annoying for scripting or other stuff:

    • forward slash (/)
    • backslash (\)
    • NULL (\0)
    • tick (`)
    • starts with a dash (-)
    • star (*)
    • pipes (|)
    • semicolon (;)
    • quotations (" or ')
    • colon (:)

    ( - maybe space though I'm reluctant to add that.)

    As you can see you might just be better off whitelisting as @Gavin suggests...

    0 讨论(0)
提交回复
热议问题