Kate : use copy/paste string to open a file

Hello.

As an example, one suppose that a string (xxxxxxxxxxxxxxxxxxxxxxxxxx) has been copied using dolphin or copied from a terminal window.
Is it possible that the string may contains any environment variable like :

  • /run/media/$USER/some_file_path
  • /run/media/$(logname)/some_file_path
    or something like that :
  • file:///home/user_install/some_path.txt

That may contain any text, including complete books.

Reading and re-reading your post above (it is a bit confusing), I think you might think that copy/paste changes something inside the string that is handles. It does not.

Real example step 1 :

(the string filename is : /run/media/$USER/LEAP_MENU_DRIVEN/RUN_MAIN_ALL_IN_ONE.sh )

Give this result ( blank ligne which mean file not found )

Of course the file exists, otherwise I will not ask the question.

How is the kate file picker supposed to know how to fill the $USER variable? What if more than one user exist on the system? Did you check for any hint in the documention/API of kate that this even a supported scenario?

Obviously from the environment.
That is why I am surprised that it does not work.
$USER is set to the current user and have nothing to do with the number of users registered on the computer.

The environment variable USER is set at login. But when it is not in the documentation of kate that it uses it in that entry field it will not. And even when it is documented it does, you should consult the documentation on how it is it to be used, because the $USER is a shell construct and it is no law that every program should do it the same way.

The idea that kate should evaluate $(logname)as if it is in the shell is very strange. It is not even an environment variable like USER.

Do you have to start kate in the graphical environment? You could start it in the terminal window with
kate /run/media/$USER/LEAP_MENU_DRIVEN/RUN_MAIN_ALL_IN_ONE.sh
by pasting your string into the command line with “ctrl+shift v” after typing kate.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.