4 ms·
With shell one can just use "${path_var##*/}" to get the base name from the string stored in $path_var. This also works if $path_var is just a base name already
by fpoling 9y ago
With shell one can just use "${path_var##*/}" to get the base name from the string stored in $path_var. This also works if $path_var is just a base name already without any slashes.
EDIT: fixed the substitution.
- josefx 9y ago> With shell one can just use "${path_var##*/}" The reason I use python whenever I need something "shell" like. Cryptic symbol salad that makes code golf fanatics green with envy.