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