как извлечь ссылки на пакеты из pacman [решено]

Hablando sobre coincidencia de patrones y sustitución en resumen para el formato ${parámetro/patrón/cadena} con algunos ejemplos:

If the pattern begins with /, all matches of pattern are replaced with string. Normally only the first match is replaced.

> test=test
> echo ${test//t/-} 
> -es-

If pattern begins with #, it must match at the beginning of the expanded value of parameter.

> test=test
> echo ${test/#t/-}
> -est

If pattern begins with %, it must match at the end of the expanded value of parameter.

> test=test
> echo ${test/%t/-}
> tes-

Un ejemplo con el uso de asterix*:

> test=test
> echo ${test/#*es/-}
> -t

Referencia:man bash:${parameter/pattern/string}

-2
16.10.2015, 15:51
0 ответов

Теги

Похожие вопросы