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

后端 未结 4 1170
情书的邮戳
情书的邮戳 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:37

    This can happen because you have a single quote in a filename somewhere...

    i.e., -> '

    To find the problem file, run the following in the terminal:

    \find . | grep \' 
    

    and it can also happen if you have an alias for xargs setup that's causing an issue. To test if this is the case, just run xargs with a \ in front of it, e.g.

    \find . | \xargs ....
    

    The "" simply means "run the command without any aliases"

提交回复
热议问题