Make xargs handle filenames that contain spaces

前端 未结 12 1177
北恋
北恋 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:48

    find . -name 'Lemon*.mp3' -print0 | xargs -­0 -i mplayer '{}' 
    

    This helped in my case to delete different files with spaces. It should work too with mplayer. The necessary trick is the quotes. (Tested on Linux Xubuntu 14.04.)

提交回复
热议问题