Make xargs handle filenames that contain spaces

前端 未结 12 1160
北恋
北恋 2020-11-29 15:21
$ ls *mp3 | xargs mplayer  

Playing Lemon.  
File not found: \'Lemon\'  
Playing Tree.mp3.  
File not found: \'Tree.mp3\'  

Exiting... (End of file)  
12条回答
  •  清酒与你
    2020-11-29 15:32

    On macOS 10.12.x (Sierra), if you have spaces in file names or subdirectories, you can use the following:

    find . -name '*.swift' -exec echo '"{}"' \; |xargs wc -l
    

提交回复
热议问题