![]() |
![]()
| ![]() |
![]()
NAMEcontains - test if a word is present in a list SYNOPSIScontains [OPTIONS] KEY [VALUES ...] DESCRIPTIONcontains tests whether the set VALUES contains the string KEY. If so, contains exits with code 0; if not, it exits with code 1. The following options are available:
Note that contains interprets all arguments starting with a - as an option to contains, until an -- argument is reached. See the examples below. EXAMPLEIf animals is a list of animals, the following will test if animals contains "cat": if contains cat $animals This code will add some directories to PATH if they aren't yet included: for i in ~/bin /usr/local/bin While this will check if function hasargs is being ran with the -q option: function hasargs The -- here stops contains from treating -q to an option to itself. Instead it treats it as a normal string to check. COPYRIGHT2024, fish-shell developers
|