Created
August 26, 2023 14:48
-
-
Save raveensrk/e09855f4f505829d9b4dde31751a760c to your computer and use it in GitHub Desktop.
Strip extension from a filename using bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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