Feed kate in the same running process with a list of file given by a for loop

Hello.
I have try many things but I cannot have a single kate process holding all the files I want to edit.
I have try with

kate -n TEST1 &
kate -n TEST1 -b &
kate --pid  PID_OF_CURRENT_RUNNING_KATE &
...
.....

Using xargs does not help in this situation.

Here is my last try
MAIN_PATH1, …,.MAIN_PATHn — are full path of style ‘/run/media/$(logname/usb_disk_name/a/b/c’

for A_FOLDER in "$MAIN_PATH1" "$MAIN_PATH2" "$MAIN_PATH3" "$MAIN_PATH4" "$MAIN_PATH5" "$MAIN_PATH6" "$MAIN_PATH7" "$MAIN_PATH8" "$MAIN_PATH9" "$MAIN_PATH10" "$MAIN_PATH11" ; do
    find "$A_FOLDER" -type f -print0 | xargs -0 kate &
done

Any help is very welcome.

Any help is welcome

You could try something like:

> kate $(find $PATH1 $PATH2 $PATHN -type f -print0 |xargs -r0 -n1 echo)

This works for me on Leap 15.5 as long as I do not exceed the maximum bash line size.
But editing more than 50 files at the same time would exaust my brain and maybe system memory anyway.

> getconf ARG_MAX
2097152

Thank you. I will try that begin next week.

It seems that the length of the string passed to kate must around 4096…
Length FILE_ALL : 4216 is too much
Length FILE_ALL : 4123 is ok

I have made the test this way :

MAIN_EDIT_PATH=“/run/media/$(logname)/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31”

FILE1=“$MAIN_EDIT_PATH/001_SCRIPTS/003_MAIN_SCRIPT/edit_edit_main_script.sh $MAIN_EDIT_PATH/001_SCRIPTS/003_MAIN_SCRIPT/edit_script_upgrade_user_script.sh…”

FILE2=" $MAIN_EDIT_PATH/001_SCRIPTS/002_PRELIMINARY_STEP/main_preliminary_script_machine.sh …"

FILE_ALL=“${FILE1}${FILE2}”

kate $(echo ${FILE_ALL} | xargs -n1 echo)

I add or remove some files in FILE2 list to find the limit.

I have founded one syntax that works :

find $PATH1 $PATH2 $PATH3 $PATH4 $PATH5 $PATH6 $PATH7 $PATH8 $PATH9 $PATH10 $PATH11 $PATH12 $PATH13 $PATH14 -type f | xargs -I{} kate {}

Thnak you for helping.

@jcdole not really related to your issue, but are you processing these files opened by kate in some way, if so your should perhaps look at using perl to process?

I work on small projects using bash scripts (about 30 files).
I found it interesting to have 2,3 or 4 windows open at the same time.
I know I can use sessions and put all the necessary files into a session.
But I thought a small piece of code should be easier to fill kate automatically.

Thank you for your interest.