Ubuntu – How to open the default GUI text editor in Ubuntu or Lubuntu via a script

default-programsgeditlubuntuscripts

I have a script that uses gedit to open text file in Ubuntu. That script does not work under Lubuntu. What command is required to execute the default text editor?

I want to make the script usable under Ubuntu and Lubuntu.

Best Answer

Use xdg-open it works in most linux distros.
example:

xdg-open /filepath/file.txt
Related Question