${string#substring}
Strips shortest match of $substring from front of $string.
${string##substring}
Strips longest match of $substring from front of $string.
1 stringZ=abcABC123ABCabc
2 # |----|
3 # |----------|
4
5 echo ${stringZ#a*C} # 123ABCabc
6 # Strip out shortest match between 'a' and 'C'.
7
8 echo ${stringZ##a*C} # abc
9 # Strip out longest match between 'a' and 'C'.
${string%substring}
Strips shortest match of $substring from back of $string.
${string%%substring}
Strips longest match of $substring from back of $string.
ID #1093
bash string manipulation
Značky: -
Související záznamy:
- VNC - vzdálená plocha + SSL
- zkonvertovat soubory (obsah) do utf8 (+ zachovat timestamp)
- zaměnit text ve více souborech
- instalace awstats (generovani offline)
- oscommerce - prechod z php4/mysql4 na php5/mysql5
K tomuto záznamu nemůžete připojit komentář.