>_ IzzyLab

Topic breakdown

A script receives data from outside through positional parameters $1, $2, and so on, but these parameters may be empty or not passed at all — reliable code must account for that case. In bash there is a parameter substitution mechanism with a fallback value of the form ${var:-default}: if the variable is empty or unset, the fallback value is substituted for it at the moment of expansion. The form with a colon (:-) also counts an empty string as "no value", unlike the form without it. The file is placed in a directory from PATH with the shebang #!/bin/bash and made executable via chmod.

What's checked

  1. say is executable
  2. with an argument the argument itself is printed
  3. without an argument hello is printed

What it looks like