Ok, so running gedit myfile.txt
works well. But what about opening a file from inside a bash script, using the default desktop app linked to the filetype?
I've tried below, which works great when run manually in terminal, but when I put it in a bash file, nothing happens:
#!/bin/bash
xdg-open "myfile.txt"&
What should I do instead?
Please note that I need the file to stay open after the terminal is closed as well.