lundi 10 août 2015

IF with no test flags?

I don't understand how to read this properly. This is an IF statement without any kind of test flags, so I don't understand the logic ... help?

    #!/bin/bash
    get_user_input() {
      if [[ $1 ]]; then
        use_default=1
      else
        use_default=
      fi

I understand that this is a function. I understand that its calling for the first positional argument ($1), but I don't understand why its in an IF statement, if they aren't testing for anything.

I've been tasked to rewrite a script from a vendor, and they have stuff like this all over the place. I'm thinking that maybe they've just purposefully over complicated things for job security?

I appreciate the help!

Aucun commentaire:

Enregistrer un commentaire