Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor config generator #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mmtj
Copy link
Contributor

@mmtj mmtj commented Nov 5, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant