I have a path as a string in a shell script, can be absolute or relative:
/usr/userName/config.cfg
or
../config.cfg
I want to extract the file name (the part after the last /, so in this case: "config.cfg")
I find the best way to do this with a simple simple expression? It's right? Should I use sed or awk instead?
The string processing functions in shell scripts look pretty primitive in themselves and seem very esoteric.
Any sample solutions are also welcome.
source
share