Fix workhorse-stunnel bash syntax
Merge request reports
Activity
@jacobvosmaer-gitlab You can use
-ne
to compare the number of args. The issue is with thex
's within the conditional statement.@MrChrisW OK! I think it works now on master, can you confirm?
@jacobvosmaer-gitlab Hey! The syntax is ok now I'm just wondering why you've got the
x
character in the conditional statement ?@MrChrisW defensive programming. http://stackoverflow.com/questions/174119/why-do-shell-script-comparisons-often-use-xvar-xyes
But now that I read more about it I suppose the best thing to do is
"x$foo = x3"
to protect against spaces.In this particular case I suppose we can treat
$#
as a trusted input though so I'll drop the x's. http://pubs.opengroup.org/onlinepubs/009604499/utilities/xcu_chap02.html#tag_02_05_02Dropped x's in 00009641
@jacobvosmaer-gitlab Really appreciate the explanation, i wasn't aware of using additional chars to avoid an edge case of empty variables!
@MrChrisW you're welcome, thanks for asking and again thanks for the MR!