RSS/Atom feed Twitter
Site is read-only, email is disabled

bash command inside script

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

bash command inside script Luis A. Florit 04 Jun 03:47
200706041649.01442.gwidion@... 07 Oct 20:25
  bash command inside script Luis A. Florit 05 Jun 02:41
  bash command inside script Luis A. Florit 05 Jun 02:50
Luis A. Florit
2007-06-04 03:47:43 UTC (almost 17 years ago)

bash command inside script

Hi,

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.

Thanks!

Luis.

Luis A. Florit
2007-06-05 02:41:56 UTC (almost 17 years ago)

bash command inside script

* El 04/06/07 a las 16:49, Joao S. O. Bueno Calligaris chamullaba:

On Sunday 03 June 2007 22:47, Luis A. Florit wrote:

Hi,

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.

Thanks!

Luis.

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)

js ->

Luis A. Florit
2007-06-05 02:50:55 UTC (almost 17 years ago)

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.