convert to POSIX.sh / styleguide #64

Closed
opened 2025-12-29 00:23:58 +01:00 by adam · 9 comments
Owner

Originally created by @bittorf on GitHub (Feb 18, 2016).

i want to send some PullRequests for converting the whole script to POSIX sh.
this issue is just for collecting some questions and answers on this regarding style.

Originally created by @bittorf on GitHub (Feb 18, 2016). i want to send some PullRequests for converting the whole script to POSIX sh. this issue is just for collecting some questions and answers on this regarding style.
adam closed this issue 2025-12-29 00:23:58 +01:00
Author
Owner

@bittorf commented on GitHub (Feb 18, 2016):

Q: is there a good reason why your are alway using -switch ... instead of just [ -switch ... ] ? e.g.

if [[ ! "${retcode}" = "0" ]] &&

can be converted to

[ $retcode -eq 0 ] || ...
@bittorf commented on GitHub (Feb 18, 2016): Q: is there a good reason why your are alway using [[ -switch ... ]] instead of just [ -switch ... ] ? e.g. ``` if [[ ! "${retcode}" = "0" ]] && ``` can be converted to ``` [ $retcode -eq 0 ] || ... ```
Author
Owner

@bittorf commented on GitHub (Feb 18, 2016):

Q: why are we always enclosing var with "${var}" even when it is unneeded? every texteditor does already highlight the variables.

@bittorf commented on GitHub (Feb 18, 2016): Q: why are we always enclosing var with "${var}" even when it is unneeded? every texteditor does already highlight the variables.
Author
Owner

@lukas2511 commented on GitHub (Feb 18, 2016):

Using [[ instead of [ because [[ is a shell built-in while [ (in theory) is a command, making the script (in theory) a bit cleaner.

Using ${var} instead of $var just as a habit and to never ever run into any problems. Also it feels good to have it consistent.

@lukas2511 commented on GitHub (Feb 18, 2016): Using `[[` instead of `[` because `[[` is a shell built-in while `[` (in theory) is a command, making the script (in theory) a bit cleaner. Using `${var}` instead of `$var` just as a habit and to never ever run into any problems. Also it feels good to have it consistent.
Author
Owner

@bittorf commented on GitHub (Feb 18, 2016):

@lukas2511 i'am OK with using ${var} - it's just a style issue.

@bittorf commented on GitHub (Feb 18, 2016): @lukas2511 i'am OK with using ${var} - it's just a style issue.
Author
Owner

@bittorf commented on GitHub (Feb 18, 2016):

@lukas2511 i understand the reason for "[[" but i'am not happy. is it OK for you when i convert them to single ones, "[[" is not defined in POSIX and this script is not about beeing very fast, but correct. (i fact most shells have 'test' aka '[' somehow builtin ...)

@bittorf commented on GitHub (Feb 18, 2016): @lukas2511 i understand the reason for "[[" but i'am not happy. is it OK for you when i convert them to single ones, "[[" is not defined in POSIX and this script is not about beeing very fast, but correct. (i fact most shells have 'test' aka '[' somehow builtin ...)
Author
Owner

@lukas2511 commented on GitHub (Feb 21, 2016):

@bittorf yes, i would be okay with that if you can work out the other stuff to make it posix compatible.

@lukas2511 commented on GitHub (Feb 21, 2016): @bittorf yes, i would be okay with that if you can work out the other stuff to make it posix compatible.
Author
Owner

@bittorf commented on GitHub (Feb 22, 2016):

ok, i will start to send small pullrequests...

@bittorf commented on GitHub (Feb 22, 2016): ok, i will start to send small pullrequests...
Author
Owner

@166MMX commented on GitHub (May 13, 2016):

I have been playing around with Travis CI and ShellCheck. Maybe it is some sort of help for you guys.

I am new to Travis CI that's why I replaced the content of the yaml file. Not sure how to integrate that into your existing one though.

@166MMX commented on GitHub (May 13, 2016): I have been [playing around](https://travis-ci.org/166MMX/letsencrypt.sh) with Travis CI and [ShellCheck](https://github.com/koalaman/shellcheck). Maybe it is some sort of help for you guys. I am new to Travis CI that's why I replaced the content of the yaml file. Not sure how to integrate that into your existing one though.
Author
Owner

@lukas2511 commented on GitHub (Jun 4, 2016):

I'm closing this ticket now. Doesn't look like anybody is working on this and I don't really have a personal interest at doing this migration. If somebody still wants letsencrypt.sh to be POSIX sh compatible please feel free to open pull-requests.

@lukas2511 commented on GitHub (Jun 4, 2016): I'm closing this ticket now. Doesn't look like anybody is working on this and I don't really have a personal interest at doing this migration. If somebody still wants letsencrypt.sh to be POSIX sh compatible please feel free to open pull-requests.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dehydrated#64