jeudi 18 juin 2020

Combine if conditions with contains function in fish shell

I can't seem to be able to combine multiple if conditions with contains function, see this example:

> function if_test
      if contains "h" $argv; or contains "-h" $argv
          functions if_test
          return
      end
  end
> if_test h
# ... works fine.
> if_test -h
# ... shows documentation of contains

This is weird because the following functions works as intended, so why is this different?

> if true; and false
     echo what
  else
    echo how
  end
how

> if true; or false
     echo what
  else
    echo how
  end
what

Aucun commentaire:

Enregistrer un commentaire