简体   繁体   中英

File name multiple extensions order

I want to create some bash scripts. They're actually going to be build scripts for Scala, so I'm going to identify them with my own .bld extension. They will be a sort of sub type of a shell script. Hence I want them to be easily recognised as a shell script. Should I call them

ProjectA.bld.sh //or

ProjectA.sh.bld

Edit: My natural inclination would be to go for the former but .tar.gz files seem to follow the latter naming convention.

A shell script doesn't mind what you call it. It just needs to be..

  • executable (chmod +x)
  • in your path
  • contain a "shebang" as it's first line #!/bin/sh

The shebang determines which program is used to execute your script.

Call it ProjectA.bld.sh (or preferably buildProjectA.sh ).

The .sh extension (although not necessary for the script to run) will allow you and everyone else to easily recognise it as a shell script.

While for the most part, naming conventions like this don't really matter at all to Unix/Linux, the usual convention is for the "extensions" to be in the order of the steps used to create the file. So, for example, a file named foo.tar.bz2.gpg.part01 would indicate a sequence of operations like the following:

  1. Use tar to create foo.tar , which contains some other files
  2. Use bzip2 to compress foo.tar into foo.tar.bz2
  3. Use gnupg to encrypt foo.tar.bz2 into foo.tar.bz2.gpg
  4. Use split or something similar to break the file into chunks for transmission/storage, resulting in one or more foo.tar.bz2.gpg.part* files.

The naming conventions are mostly just for human semantic meaning, though, and there's nothing stopping you from doing exactly the opposite, or even something completely random, except your own ability to remember exactly what you did...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM