Get Filename From Path in Bash
Directory names can be part of a path even when a Bash script needs only its final component. GNU basename prints that component, while Bash parameter expansion can remove the directory portion from a variable. This article shows how to use both methods and explains what happens when a path ends in a slash. TL;DR
Get Filename From Path in Bash Read More »