pulseaudio-equalizer-ladspa / equalizer

Pulseaudio LADSPA Equalizer
GNU General Public License v3.0
135 stars 15 forks source link

Refactor config generator #43

Open mmtj opened 4 years ago

mmtj commented 4 years ago

Unfortunately PR #41 fixed issue by side effect. This PR intends to provide proper fix and little refactoring.

Trouble is that regular expression in sed never matches and thus keep string unchanged.

trimmed=$(echo $RAWDATA1 | sed 's/ *$//g')

What actually trim first space is echoing $RAWDATA without quotation marks. echo "$RAWDATA1 would echo string as is, but regexp in sed still wouldn't match.

So I tried to go full bash route here, but I could just rewrite sed expression if you prefer that. There is practically identical block of code which could look better in own reusable function. Only caveat I see here is that this code will work only on bash 4.3+, because of nameref used here.