Extract filename and extension in Bash

First, get file name without the path: Alternatively, you can focus on the last ‘/’ of the path instead of the ‘.’ which should work even if you have unpredictable file extensions: You may want to check the documentation : On the web at section “3.5.3 Shell Parameter Expansion“ In the bash manpage at section … Read more

Should Python class filenames also be camelCased?

The following answer is largely sourced from this answer. If you’re going to follow PEP 8, you should stick to all-lowercase names, with optional underscores. To quote PEP 8’s naming conventions for packages & modules: Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. And for classes: Class … Read more

Extract file basename without path and extension in bash

You don’t have to call the external basename command. Instead, you could use the following commands: Note that this solution should work in all recent (post 2004) POSIX compliant shells, (e.g. bash, dash, ksh, etc.). Source: Shell Command Language 2.6.2 Parameter Expansion More on bash String Manipulations: http://tldp.org/LDP/LG/issue18/bash.html