1

Although one can easily make an executable file named ./42 or even ./カラオケ, I find no common packages that include letter-free commands. On Ubuntu, for example, apt-file find . | grep -i -e '/[^a-z/_\-]+$' reports that every executable file's basename has at least a letter or underscore or dash. The only letter-free files or dirs that I found were non-executable, and usually version numbers: docbook/dtd/xml/4.1.2, /usr/include/c++/4.8.2, etc.

Do any published rules or standards constrain how commands may be named? Or is this merely cultural practice?

  • 4
    Short of an answer, but the POSIX spec for path names says: ... "If a pathname consists of only bytes corresponding to characters from the portable filename character set (see Portable Filename Character Set), <slash> characters, and a single terminating <NUL> character, the pathname will be usable as a character string in all supported locales" ... – Jeff Schaller May 11 '18 at 17:18
  • So the P.F.C.S. is letters, digits, dot, dash, and underscore. At least that rules out katakana, cyrillic, etc. – Camille Goudeseune May 11 '18 at 18:50
5

Counterexample: the [ command, the one you use when you write if [ "$foo" = bar ]. It's the same as test, except that it requires the final ] argument, and is a standard utility.

Yes, it's an executable file:

# ls -l "/usr/bin/["
-rwxr-xr-x 1 root root 51920 Mar  2  2017 /usr/bin/[
  • Doh! (Then I'm confused why apt-file find /usr/bin/\[ finds it, but apt-file find . doesn't. usr/bin/[ is in security.ubuntu.com_ubuntu_dists_trusty-security_Contents-amd64.gz; maybe instead I should've done zcat | grep.) – Camille Goudeseune May 11 '18 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.