LoginSignup
8
5

More than 5 years have passed since last update.

findコマンドを使ったらfind: paths must precede expressionとなったときの対応方法

Posted at

事象 : GNUのfindコマンドでファイル名を *3* で検索したら怒られた

  • 環境
    • Windows7 64bit
    • GitBash
$ find --version
find (GNU findutils) 4.6.0
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
​
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)

$ find . -type f -iname *3*
find: paths must precede expression: 30_hoge.sql
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

理由 : "で囲んでいないから

対応方法 : "で囲む

$ find . -type f -iname "*3*"
30_hoge.sql
31_fuga.sql
8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5