If type "$x" >/dev/null 2>/dev/null thenĮxec "$x" programs do whitespace splitting on $VISUAL and $EDITOR, but not all. On Debian and Debian-like systems, invoke sensible-editor, which does all that stuff for you - but I don't know of anything like it on other Unix variants.Įxec $EDITOR type sensible-editor >/dev/null 2>/dev/null thenĮxec sensible-editor cmd=$(xdg-mime query default ) 2>/dev/null then You can try xdg-mime query default, but even where the utility is available, it doesn't always work. Unfortunately there's no good, portable way to find a decent editor. This is not at all user-friendly - people who use vi know how to set up their system to invoke it, your application should be friendly to those users who don't. Otherwise, Unix tradition defaults to vi. Otherwise, if the environment variable EDITOR is set, use that. ![]() If the environment variable VISUAL is set, use that.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |