BASH logo
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/bin/bash
fname="a.tar.gz"
# get ext
echo ${fname##*.}
# get name
echo ${fname%.*}
#!/bin/bash fname="a.tar.gz" # get ext echo ${fname##*.} # get name echo ${fname%.*}
#!/bin/bash

fname="a.tar.gz"

# get ext
echo ${fname##*.}

# get name
echo ${fname%.*}

Нашел в форуме linux.org.ru