Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 3
    Which characters are allowed or disallowed depends on the filesystem in use. Commented Oct 1, 2012 at 2:51
  • @JimParis Do you have an example of a *nix filesystem that doesn't allow characters other than \0 and /? Commented Oct 1, 2012 at 4:43
  • Also interesting in this context: Understanding Unix file name encoding Commented Oct 1, 2012 at 7:07
  • @JimParis you were right. Commented Oct 1, 2012 at 13:27
  • 1
    "I'm writing a shell script that requires the user to type a file name and I would like to make sure the name doesn't have any invalid characters. Is there a list somewhere?" Just try to create the file, and fail cleanly and tell them if it didn't work. There are other reasons file creation could fail (creating under a nonexistent directory, for example), and trying to check for all of them in advance just opens you to a race condition. Commented Oct 1, 2012 at 15:14