fix: syntax to support older bash versions#100
Merged
davidcheung merged 5 commits intomainfrom Sep 18, 2020
Merged
Conversation
the pipes confuses older bash versions to run commands after pipe locally instead of passing to remote
bmonkman
approved these changes
Sep 18, 2020
bmonkman
reviewed
Sep 18, 2020
|
|
||
| # get pod id for execution | ||
| POD=$(kubectl -n vpn get pods | grep wireguard | cut -d' ' -f1) | ||
| EXTERNAL_DNS=$(kubectl -nvpn get svc wireguard -o jsonpath='{.metadata.annotations.external-dns\.alpha\.kubernetes\.io/hostname}') |
davidcheung
commented
Sep 18, 2020
| existing_ips=$($EXEC cat /etc/wireguard/wg0.conf | grep AllowedIPs| cut -d" " -f3 | cut -d"/" -f1 | sort) | ||
| last_ip=$(echo "$existing_ips" | tail -1) | ||
| existing_ips=$($EXEC "cat /etc/wireguard/wg0.conf | grep AllowedIPs| cut -d\" \" -f3 | cut -d\"/\" -f1 | sort") | ||
| last_ip=$(echo "$existing_ips" | tr -cd "[:alnum:]." | tail -1) |
Contributor
Author
There was a problem hiding this comment.
somehow when it doesnt work for me unless I sanitize the string tr -cd "[:alnum:]."
I've tried to pipe it into a file and look at it but it looks fine
bmonkman
approved these changes
Sep 18, 2020
bmonkman
pushed a commit
that referenced
this pull request
Oct 10, 2020
* fix: syntax to support older bash versions the pipes confuses older bash versions to run commands after pipe locally instead of passing to remote
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the pipes confuses older bash versions to run commands after
pipe locally instead of passing to remote
with help from @sshi100 we found out in
bash 3.xit gets confused and tries to runwglocallyand in
bash 5.xit works fine