bashHow to extract file extension
filename=/tmp/test.php
extension="${filename##*.}"
ctrl + c
"${filename##*.}" extracts file extension. Use |
More of Bash
- How to check if a string starts with a specific value
- How to convert string to uppercase
- How to assign an output of a command to a variable
- Quickly create big file
- How to extract file name
- How to get date in "YYYY-MM-DD" format
- Urlencode string in bash
- How to convert string to lowercase
- How to check if a command exists
See more codes...