I am calling kate from a shell script (saying : edit_files_of_the_day.sh ) for editing some kind of files in the same windows.
The script was running fine until opensuse 10.3.
Something like :
cd /my_dir1/my_dir2
for afile in paul.txt pierre.txt jean*.txt ; do
kate -u $afile
done
cd /my_dir1/my_dir4
for afile in manchester.txt Italy* ; do
if -d "$afile" ]; then
echo "$afile is a directory. Nothing to do"
elif -f "$afile" ]; then
kate -u $afile
else
echo "$afile does not exist or is a special file. Nothing to do"
fi
done
For 11.1, I had to modify the script by adding the following at the beginning of the shell.
( see also & at the end )
kate -u /my_data/dummy_file &
and /my_data/dummy_file must exists otherwise kate stop loading files after the first one; waiting I close it for opening the next one and so on.
Don’t ask me why it was working.
Now I am running 12.14.
The script is working only once.
After that it stop loading with these errors :
linux:~/bin # ./edit_files_of_the_day.sh
kate(9769) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9790) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
linux:~/bin #
How could I call kate within for loop ?
kate-4.7.2-2.1.2.x86_64
KDE : Revision KDE 4.7 (2011-09-04)
So a command like “kate -u /my_data/dummy_file &”, will put that command running into the background (due to the & at the end). Loading Kate in a for/do/done loop would attempt to load all matching files up into Kate at the same time. I don’t know for sure, but Kate may have a limit of 14 or so loaded text files, while you are trying to load 16 or more. The real question in my mind is why do you need to load so many files at once? I am doing good to edit one file at a time. However, I could not really tell what the end game was on editing so many files at once. I don’t normally use Kate, but rather kwrite, but I have several scripts, using kwrite, that can be modified to use kate. Maybe one of these bash scripts will meet your fancy?
Nice exercise on scripting but, here’s what I do, does not need any scripts which need to be modified for different projects: I use Kate.
Just open the files (file - open - selections possible).
Then Sessions - Save As, give session a name.
Next time: start Kate (it will by default open the last session. If needed select the saved session of you choice. Example: I develop on several websites, hundreds of php files in a session, named after the site. If more files are to be opened in the session, open session, open extra files, save session, files now belong to the session.
>
> Nice exercise on scripting but, here’s what I do, does not need any
> scripts which need to be modified for different projects: I use Kate.
>
> Just open the files (file - open - selections possible).
> Then Sessions - Save As, give session a name.
>
> Next time: start Kate (it will by default open the last session. If
> needed select the saved session of you choice. Example: I develop on
> several websites, hundreds of php files in a session, named after the
> site. If more files are to be opened in the session, open session, open
> extra files, save session, files now belong to the session.
>
already wanted to suggest the same, but then i thought he probably knew
that already, sine he’s using kate with multiple files, and wants to
determine which files to open depending on some variable: the directory
he’s in, or the server he’s on, or whatever.
don’t know his use case, but seems to be too much effort to me, since
kate’s sessions are quick to define and use, and flexible: “kdesu kate”
for admin. tasks, and remote files via fish:/, per example. all gets saved
in these sessions, and opened again next time. (i found that opening
remote files is convenient & quick by dropping them into kate from an open
konqueror window. otherwise it may take a while until the file dialog
opens a remote connection.)
But any way , why was it working until 10.3 and not now.
Now why is it working only once until I reboot…
**linux:~/bin #** ./logs_read_part0
kate(9769) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9790) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9792) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9794) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9796) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9798) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9800) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9802) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9804) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9806) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9808) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
kate(9810) KXMLGUI::ActionList::plug: Index 16 is not within range (0 - 14
**linux:~/bin # **
I am using this kind of script for opening all samba, ldap config files at once, all logs at ounce, …
I am able to load all this files by hand one by one.
>
> Thank you for all of you.
>
> But any way , why was it working until 10.3 and not now.
>
> Now why is it working only once until I reboot…
>
>
> Code:
> --------------------
> LINUX:~/BIN # ./LOGS_READ_PART0
> KATE(9769) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9790) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9792) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9794) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9796) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9798) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9800) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9802) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9804) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9806) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9808) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> KATE(9810) KXMLGUI::ACTIONLIST::PLUG: INDEX 16 IS NOT WITHIN RANGE
> (0 - 14
> **LINUX:~/BIN #
> --------------------
>
>
> I am using this kind of script for opening all samba, ldap config files
> at once, all logs at ounce, …
>
> I am able to load all this files by hand one by one.
>
i have no idea. perhaps you should ask on the KDE mailing list? i seem
to remember to have seen such a bug in the KDE bug tracker, but it’s been
a while ago, and i don’t know for which version of KDE that was, and if it
was really your problem or not. i came across it while searching for
another bug and didn’t pay much attention.