0

I'm tring to apply an effect on a picture but my shell command return me an error but I don't see it. Someone see what's wrong ?

My command :

convert ( /var/www/folder/img.jpg -modulate 120,50,100 ) ( -size 980x650 -fill rgba(255,153,0,0.5) -draw "rectangle 0,0 980,650" ) -compose multiply /var/www/folder/f3-img.jpg ; 

The error

:syntax error near unexpected token `/var/www/folder/img.jpg'

Thanks for your help :)

shellter
  • 36,525
  • 7
  • 83
  • 90
slig36
  • 187
  • 3
  • 13

1 Answers1

2

The brackets () are special commands in Bash command-line. They spawn a new shell when they are surrounding a command, or (credits to @pabouk) they signal a function definition. Neither is the intended case for you.

The bottom line is that brackets () have special meaning for the bash shell, so you need to escape brackets, prefixing them with a backslash, so that bash doesn't try to interpret them:

\( and \)

user1284631
  • 4,446
  • 36
  • 61
  • I tried to chage the path of my picture into convert ( img.jpg -modulate 120,50,100 ) and I get the same error with or whitout escpace ( ) – slig36 Dec 14 '12 at 14:50
  • @user1771274: path has nothing to do with that. in your original command, just delete the brackets (parantheses) and execute the command again – user1284631 Dec 14 '12 at 14:58
  • @axeoth: Though the solution is correct the explanation you provided is not completely right. `()` spawn a new sub-shell only if the opening `(` is at the place a normal command is expected. If the shell was trying to execute the image as a command the error message would be something like: `/var/www/folder/img.jpg: Permission denied` (file has no executable flag set) or an error message of a failed `exec()` call. – pabouk - Ukraine stay strong Sep 09 '13 at 10:31
  • @axeoth: In the context of command arguments `()` signify a function definition. See http://stackoverflow.com/questions/2188199/how-to-use-double-or-single-bracket-parentheses-curly-braces/18694716#18694716 – pabouk - Ukraine stay strong Sep 09 '13 at 10:34