find: missing argument to -exec in bash script

Posted by Mephi_stofel on Stack Overflow See other posts from Stack Overflow or by Mephi_stofel
Published on 2012-12-20T10:35:51Z Indexed on 2012/12/20 11:03 UTC
Read the original article Hit count: 173

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about bash

Related posts about shell