bashHow to extract file extension
filename=/tmp/test.php
extension="${filename##*.}"
ctrl + c
"${filename##*.}" extracts file extension. Use |
More of Bash
- How to assign an output of a command to a variable
- How to extract file name
- How to check if a string starts with a specific value
- Quickly create big file
- Binet's Formula in bash
- How to convert string to lowercase
- Urlencode string in bash
- Change permissions using chmod in bash
- How to check if variable is empty
See more codes...