Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get the basename for a URL or path file
# Turn a URL or path like this:
# ""
# into this:
# "daa535a86371482ec8fd7f3451114367.png"
function get_basename () {
echo "$1" | rev | cut -d / -f 1 | rev

This comment has been minimized.

Copy link
Owner Author

commented May 24, 2017

Just found out this is already a thing:

basename "$1"


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.