bash command inside script
Sorry for the empty email I've just sent. My mistake.
Now, about my question:
Is there a way to read the output of a bash command inside
a script-fu? I want to make a script-fu that uses the ExifTool
program output.
This is to answer Kevin:
Save the output from the ExifTool to a file and have the
Script-Fu script read the file with the saved output.
I think this is not practical for what I need (that of course you
didn't need to know).
My script has a field in the GUI to enter the ExifTool data.
I think that copy-pasting the data to this field is easier
than running Exiftool, saving its output to a file for each image.
Now, the answer to Joao:
two words:
go python
---------
Seriously. Script-fu has the advantage that it can have a small
itnerpreter which can therefore live inside GIMP's source tree. And
that is it. Of course, it fits whoever likes solving puzzles on how
to perform simple tasks such as parsing a string letter by letter, or
getting the output of a file.
Python is a full featured language, which greatest advantage is to
allow one to concentrate on his problem instead of the language.
Just check some of the python-fu examples that come with GIMP itself.
Use the "os" module to be able to spawn sub-proccess and read the
output, like in:]
import os
files = os.popen ("ls devel/gimp").readlines()
for file in files:
... print file.upper()
...
ACINCLUDE.M4
ACLOCAL.M4
APP
AUTHORS
(in time: the >>> and ... are prompts put ther by the interactive
interpreter, not part of the language itself)
I agree. In fact, I always found the script-fu language
(a variant of lisp, right?) simply horrible.
However, my script-fu is 100% functional, and I think that it doesn't
worth it the effort to translate the full script to python just because
of this. But I will take your advice for the next time, and my next
plugin will be in python from the beginning.
Thank you both!!!
L.