[SOLVED]Bash script single quote question
Hi!
I am trying to incorporate a gimp batch script into a bash script. The gimp command have to use single quotes Example: Code:
gimp -i -b '(my-script "script-argument")' -b '(gimp-quit 0)' The problem is that i need to pass a bash variable as an argument to my gimp function. I tried this: Code:
gimpcmd="gimp -i -b '(batch-coelipse \"$filename\")' -b '(gimp-quit 0)'" I also played around with it on the command line. It works if I echo the $gimpcmd, copy the output and run it as a command. But it fails if I try too run $gimpcmd as a command. Does anyone know how to throw a variable in between two single quotes in a bash script? //John |
What about closing the single quotes immediately before the $filename variable?
Code:
gimp -i -b 'my-script '\"$filename\" -b '(gimp-quit 0)' |
Probably the gimp command doesn't need single quotes but it needs to be made up of separate words:
Probably your script builds the command OK but when you try to run it as $gimpcmd (the enclosing () simply run it in a subshell), bash separates it into words at metacharacters which include "(", ")" and space. What you are trying to do is difficult in bash. For your command it could probably be done by loading an array with individual words of the array providing the file name does not contain whitespace: Code:
command[1]=gimp |
Quote:
//John |
Code:
gimpcmd[1]=gimp Thank you very much! |
All times are GMT -5. The time now is 02:06 PM. |