bash parameter expansion not working as expected -


the below example 1 of many web pages consulted. cannot "remove beginning till marker" or "remove marker till end" work, perhaps wrong how specify pattern? final goal remove line of text, given marker till end. solution sed might found 1 annoys me.

version=0.11.3-issue#18.6a0b43d.123 # 1 works expected echo ${version/\#/} 0.11.3-issue18.6a0b43d.123 # others don't, return input unchanged # trying remove 'i' syntax straight echo ${version%i} 0.11.3-issue#18.6a0b43d.123 echo ${version%\i} 0.11.3-issue#18.6a0b43d.123 ${version%%\i} 0.11.3-issue#18.6a0b43d.123 echo ${version%%i} 0.11.3-issue#18.6a0b43d.123 

the problem thing after # or % isn't marker, pattern.

echo ${version%i*} 

add asterisks match rest of value.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -