Skip to content

Instantly share code, notes, and snippets.

@raveensrk
Created August 26, 2023 14:48
Show Gist options
  • Save raveensrk/e09855f4f505829d9b4dde31751a760c to your computer and use it in GitHub Desktop.
Save raveensrk/e09855f4f505829d9b4dde31751a760c to your computer and use it in GitHub Desktop.
Strip extension from a filename using bash
#!/bin/bash
name="$(basename "$1")"
name_without_extension="${name%\.*}"
echo "$name_without_extension"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment