Skip to main content

Thread: Bash: Please explain ${var##*.}


i'm using bash find last part of string e.g. 'myfile.3' - found method works, don't know why!

should googling find out more this? reg exp or else?

code;
code:
var=my.test.file.23.45 echo $(( ${var##*.} + 1 ))
that returns '46', correct (i.e. 45+1) - need understand var##*. piece. how saying 'go end of string, part after '.', , return that'

look @ bottom of page, explains well.

http://mywiki.wooledge.org/bashguide/parameters

in order answer question should searching it's called parameter expansion.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] Bash: Please explain ${var##*.}


Ubuntu

Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

2.5.28 to 3.4.1---Download of update package failed - Joomla! Forum - community, help and support

Your host needs to use PHP 5.3.10 or higher to run this vers - Joomla! Forum - community, help and support