4 ms·
I don't know where you learned shell scripting, but your formatting is very confusing and nonstandard. - while...; do / if ...; then - space before ;; - no s
by sacnoradhq 4y ago
I don't know where you learned shell scripting, but your formatting is very confusing and nonstandard.
- while...; do / if ...; then
- space before ;;
- no space before case match
- use util-linux getopt because getopts doesn't handle long args
- DRY with a die() function rather than exits littered all over
- fsckboy 4y ago>I don't know where you learned shell scripting, but your formatting is very confusing i don't know where you learned English composition, but I can't follow your critique. are you pointing out your preferences (which may well match gnu or bsd standards, i don't know tell me) or things that actually make a difference? Did he break emacs auto-indent? Are you pointing out all the flaws or the correct ways, i'm having to eyeball diff. Use more of your words. while do doesn't seem substantially worse/confusing compared to while;do unless you have some reason? spacing out ;; does it make a difference? or do you like things spaced out? etc.
- sacnoradhq 4y agoFlagged for not being a professional response to constructive feedback.
- yesenadam 4y agoI thought it was "professional", helpful, and a great comment. I didn't think yours was constructive, just unhelpfully treating a different formatting style as objectively worse, in an unfriendly way. "Be kind"! It was also hard to parse, as the GP pointed out. edit: You changed your comment after I wrote this. Now it mentions that you flagged the GP. That's ridiculous.
- sacnoradhq 4y agoYou have way too much time on your hands and seem determined to argue nonconstructively. Have a good one.
- yesenadam 4y ago> You have way too much time on your hands and seem determined to argue nonconstructively. Have a good one. Please refresh on the HN comment guidelines. And reconsider who has been "constructive" vs "nonconstructive" in this thread.
- databasher 4y agoIf you refer to my example above, you'll find that Bash's native "getopts" handles long options just fine. It accepts short option `-`, with an argument. This handles --long-options and --long-options=with-arguments. Feel free to use your own formatting preferences.
- sacnoradhq 4y agohttps://google.github.io/styleguide/shellguide.html https://google.github.io/styleguide/shellguide.html