SyntaxFix
Write A Post
Hire A Developer
Questions
Another option is to use bash parameter substitution.
bash
$ foo="/home/parent/child/filename" $ echo ${foo##*/} filename $ foo="/home/parent/child/child2/filename" $ echo ${foo##*/} filename