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

Low: use bash in rgmanager/src/clusterfs.sh rather than clunky sed/awk #530

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

Conversation

grooverdan
Copy link

since bash can do find and replace and variable extraction lets use it.

@grooverdan
Copy link
Author

set -o posix
line='xxx aaa(bbb)ccc'
nfsexp=${line%% *}
parop=${line##*\(}
nfsopts=${parop%%\)*}
nfsacl=${op%%\(*}
echo $nfsexp
xxx
echo $nfsopts
bbb
echo $nfsacl
aaa

@grooverdan
Copy link
Author

clusterfs is bash so {OCF_RESKEY_options//,/ } is allowed

@davidvossel
Copy link
Contributor

These are all technically superior improvements, but I'm unsure if introducing these kinds of changes is actually better for the project. Perhaps it is just me, but I actually like seeing sed/awk/grep because I use those commands everyday to do complex things on the command line. When I see those commands in a script I know exactly what I'm looking at. It's more obvious. When we use sh builtin functionality it takes me longer to process what's going on. Its harder for me to maintain the code.

Just out of personal preference, I'm not excited about this change. If others in the community would like to see more usage like this, then I wouldn't be upset if the patch got merged.

@grooverdan
Copy link
Author

#536 (comment) applies - similar sentiment. commented there before I saw this comment.

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

Successfully merging this pull request may close these issues.

3 participants