Lets say I have three image files to edit. Consider all the files are in ~/Pictures
. Let name of the first file be 1.svg
, name of the second file be 2.svg
and name of the third file be 3.svg
.I have Inkscape editor. Now, I want a bash script to be executed so that the following must happen:
- First
1.svg
must open for me to edit. - After editing, when I close that file, automatically
2.svg
must open for me to edit. - Now when I complete editing
2.svg
, I want3.svg
to open for editing. - Now after editing
3.svg
the script must end by closing GIMP.
PS:- If you are wondering if this is home work, it is not! See here . You will notice that I have to edit images there. To make that answer better I need help here. So please help. Also I AM A COMPLETE BEGINNER. I don't know anything about bash. So explain your answer as elaborately as possible. Also you might consider giving an answer with GIMP editor to edit .jpg files . It might be useful for others. By the way, I am using 14.04 LTS . Thanks in advance.
UPDATE :- The above linked answer was edited according to the accepted answer below.
As Rmano says, you can simply do a
for
loop in the terminal:Either run this in the directory where the files are, or each file should have the rest of the path to it. You can put as many files as you want in there.
GIMP will open the file, you edit it, and then close GIMP. Once GIMP closes, the
for
loop continues and opens the next file in the list.If you don't want to close GIMP every time, you can try adding a
read -p
:Once you finish editing a file, you should be able to press Enter in the terminal and the next file should open in GIMP, without having to close GIMP.
This is the simplest way I could think of, it may get complicated trying to detect when GIMP closes a file.
Note for your case
Most of the files are SVG files, as Rmano pointed out. So list all of your SVG files and replace
gimp
withinkscape
. The PNG files will be fine withgimp
.The following command opens the files in the default associated application:
If you want to open all the
.svg
files in alphabetical order, you can use the*
wildcard:*
stands for any sequence of characters, so you can use it in other ways; for example, to successively open the.svg
files whose name containswibble
:Other wildcards exist if you want to select files based on finer-grained patterns.
You could try something like this:
I tested it on my Pictures directory and it seemed to work.
I don't entirely understand the first line yet, but it is there to help make sure my
*
works. Thefor
loop then loops through everything in the current directory one at a time. If it isn't a directory it opens it in Inkscape for editing.When you're done editing and close inkscape the next image will open until there are no more images.
For your specific case (after reading the linked question) this might work better. Remember to
cd
to/usr/share/unity/icons
and then run this:replacing
file1.svg file2.svg file3.svg
with a list of the files you want to edit.