find: missing argument to
The following works fine when I type it exactly in the command line:
find /<some_path>/{epson,epson_laser,epson_inkjet} -iname "*.ppd" 
  -exec grep "*ModelName:" {} ; | sed 's/.*"(.*)"/1/'
 However, when I try to call the following from a bash script I get find: missing argument to -exec' .  
I have also tried the following (in many variants):
eval find "$1" -iname "*.ppd" -exec 'bash -c grep "*ModelName:" "$1" | sed "s/.*"(.*)"/1/" ;
as was mentioned in find-exec-echo-missing-argument-to-exec. How can I get to work first code not only in terminal, but also in bash script?
 PS: I've used eval only for expanding string "/<some_path>/{epson,epson_laser,epson_inkjet}" to multiple paths.  Does anyone know better solution for doing this?  
 If you want to execute multiple commands over the output of find , just use the -exec options as many times required:  
find -exec command1 "{}" ; -exec command2 "{}" ;
You can also define the conditions to execute an option:
find ( -exec command1 ; -false -o -exec command2 ; )
In your case, you need something like this:
find /<some_path>/{epson,epson_laser,epson_inkjet} -iname "*.ppd" -exec grep "*ModelName:" "{}" ;  sed 's/.*"(.*)"/1/' "{}" ;
上一篇: 在Linux CLI中使用相对于当前目录的路径递归列出文件
下一篇: 找到:缺少参数
