5 ms·
That's a really neat way of trimming the file extension, something that can end up being quite tedious to do with SED. Do you know of a cheatsheet that descri
by olsgaarddk 6y ago
That's a really neat way of trimming the file extension, something that can end up being quite tedious to do with SED.
Do you know of a cheatsheet that describes what all the percentage sign means and other things you can do with parameter expansions?
- Symbiote 6y agoThe old way to remove a file extension is using basename: basename -s .png example.png example
- mhd 6y agoAlso strips the path and you have to know the extension name(s). For my examples, "cut" would be appropriate. But those substitutions tend to work in anything POSIX, not just bash/zsh.
- Tiksi 6y agoThe bash hackers wiki has a pretty good list of the bash/posix one, tldp does too, but I find it less straight forward. https://wiki.bash-hackers.org/syntax/pe https://wiki.bash-hackers.org/syntax/pe https://tldp.org/LDP/abs/html/parameter-substitution.html https://tldp.org/LDP/abs/html/parameter-substitution.html The zsh docs are good for the zsh specific expansions, but more man page than cheatsheet, though they do have an intro doc on it that's more cheatsheet like but less complete. http://zsh.sourceforge.net/Doc/Release/Expansion.html http://zsh.sourceforge.net/Doc/Release/Expansion.html http://zsh.sourceforge.net/Intro/intro_12.html http://zsh.sourceforge.net/Intro/intro_12.html