bash syntax [was: m4a->mp3 help]
Nils Kassube
kassube at gmx.net
Mon Oct 13 10:39:55 UTC 2008
Jonas Norlander wrote:
> So in short ${fn%m4a} would match and remove m4a from the end of the
> string and ${fn#m4a} would from the beginning of the string?
Right.
> But what
> about the %% and ## syntax?
If you use the "*" wildcard within the string to remove, %% and ## match
the longest possible string while % and # match the shortest possible
string. Example:
~/ > fn=/usr/bin/bison
~/ > echo ${fn##*bi}
son
~/ > echo ${fn#*bi}
n/bison
~/ > echo ${fn%bi*}
/usr/bin/
~/ > echo ${fn%%bi*}
/usr/
Nils
More information about the kubuntu-users
mailing list