Getting error “xargs unterminated quote” when tried to print the number of lines in terminal

后端 未结 4 1247
情书的邮戳
情书的邮戳 2021-01-31 02:57

I want to get the number of lines in my application. I am using this code:

find . \"(\" -name \"*.m\" -or -name \"*.h\" \")\" -print | xargs wc -l
4条回答
  •  情深已故
    2021-01-31 03:38

    The canonical way to solve quotes, spaces and special characters problems when using find is to use the -exec option instead of xargs.

    For your case you can use:

    find . "(" -name "*.m" -or -name "*.h" ")" -exec wc -l "{}" \;
    

提交回复
热议问题