echo $SHELL /bin/bash bash --version GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu) ls test*.py test1.py test2.py test3.py test4.py ls test[1-4].py test1.py test2.py test3.py test4.py
echo $SHELL /usr/bin/fish fish --version fish, version 2.7.1 ls test*.py test1.py test2.py test3.py test4.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,
**\/*.fishin zsh will match
.fishfiles in the PWD but in fish will only match such files in a subdirectory. In fish you should type
***.fishto 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での具体例の解説～