not sure if i'm reading a shell script properly ... here's a script
for downloading and installing kubernetes:

but it seems to be doing strange (messy) things with parameter

  first, there's this bit of weirdness partway through the script:

    if [[ -x ./cluster/ ]]; then
      # Make sure to use the same download URL in

  i'm unsure of the value of assigning a variable to itself; is there
something subtle or tricky about that assignment that isn't obvious?

  then there are a number of constructs like this:

    if [[ -n "${KUBERNETES_SKIP_CREATE_CLUSTER-}" ]]; then
      exit 0

  AIUI, the whole point of the construct ${VAR-default}

is if VAR is not set, then the value of "default" will be used. so
what does it mean to say:


that is, to have the empty string as the default value? is this some
magic that i am unaware of?

  and there's this near the top:


ok, that will admittedly set that variable to a value if it does not
already have a value, but i've always done that this way:

  : ${VAR:=defaultvalue}

the script clearly works, but it seems to have been written by someone
who didn't quite grasp proper parameter substitution. thoughts?

Linux mailing list

Reply via email to