I was writing a shell script and ran into a problem. Is there a way to open a file using the user's specified text editor?
相关问题
- How to get the return code of a shell script in lu
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- JQ: Select when attribute value exists in a bash a
- Invoking Mirth Connect CLI with Powershell script
Ignacio's right (though arguably, the fallback should be
ed
, which POSIX requires to be present, although it's essentially only useful to old-timers).If you're thinking about graphical editors,
xdg-open file.txt
is what you're after.The user's chosen editor should be in
$EDITOR
, but you must still choose a sane default.note:
xdg-open file.xml
will open in a Web-Browser, most likely. So, try;