echo $SHELL

bash --version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)

ls test*.py

ls test[1-4].py



echo $SHELL

fish --version
fish, version 2.7.1

ls test*.py

ls test[1-4].py
ls: cannot access 'test[1-4].py': No such file or directory



If a star (*) or a question mark (?) is present in the parameter, fish attempts to match the given parameter to any files in such a way that:

  • ? can match any single character except ‘/’.
  • * can match any string of characters not containing ‘/’. This includes matching an empty string.
  • ** matches any string of characters. This includes matching an empty string. The matched string may include the / character; that is, it recurses into subdirectories. Note that augmenting this wildcard with other strings will not match files in the current working directory ($PWD) if you separate the strings with a slash (“/”). This is unlike other shells such as zsh. For example, **\/*.fish in zsh will match .fish files in the PWD but in fish will only match such files in a subdirectory. In fish you should type ***.fish to match files in the PWD as well as subdirectories.

cf. Glob matching (wildcards) in fish shell not matching bash behavior

cf. fish: Documentation

cf. Linux【ワイルドカードと正規表現】の違い, 展開の動作 ~ls, grep, findでの具体例の解説~