til icon indicating copy to clipboard operation
til copied to clipboard

Shell Parameter Expansion

Open xluffy opened this issue 2 years ago • 0 comments

eg: How to extract filename and extension

> FILE="example.tar.gz"

> echo "${FILE%%.*}"
example

> echo "${FILE#*.}"
tar.gz

> echo "${FILE##*.}"
gz

https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

xluffy avatar Jun 22 '22 02:06 xluffy