[SOLVED] How to open default text editor from bash script?

as header states i would like my script to open the desktops default text editor. I use xfce.
I currently have it set to open medit, however i want to be able to use script on other desktops
Last edited by orphius (2013-07-12 07:24:34)

Trilby wrote:
EDITOR will often not be the default desktop environment editor - it is usually limited to being a systemwide (and usually console-ready) editor.
xdg-open, or a related tool, can give you the desktop's text editor.
Truth. VISUAL is typically used for the graphical text editor.
So, to use VISUAL if it exists, but otherwise default to medit, do:
editor="${VISUAL:-medit}"
$editor foo.txt
Last edited by jakobcreutzfeldt (2013-07-11 07:09:02)

Similar Messages

  • How to call a text editor from a module pool program

    Hi All,
    I want to call the text editor from my modulepool program. Enter my text in it and save it.This text needs to be saved in a Z-program with 2 fields as primary keys. The next time while I call this same record from this z table, I need to fetch the existing text and display it.
    The user now can put in additional text and can again save it. This process thus goes on..
    If anyone has worked in this type of scenario, then please help me in doing this.
    Useful answers will surely be rewarded.
    Thanks,
    Susanth.

    Hi Sushanth,
    We save the text not as fields in a ztable directly but as a text.Please check the format below since it is based on a working code....
    first you need to create a text in s010 transaction...
    there should be some key based on which you plan to save the text..imagine it is Purchase order then..PO+item numner is always unique.eg:0090010(900PO/item10).so in the code you can append these two and they will be unique..so you can always retrieve them,overwrite,save them anytime you need
    **************data declarations
    TYPES: BEGIN OF TY_EDITOR,
    EDIT(254) TYPE C,
    END OF TY_EDITOR.
    data: int_line type table of tline with header line.
    data: gw_thead like thead.
    data: int_table type standard table of ty_editor.
    ****************fill header..from SO10 t-code..when you save you need the unique key..youfill it here and pass it in save_text function module
    GW_THEAD-TDNAME = loc_nam. " unique key for the text -> our unique key to identify the text
    GW_THEAD-TDID = 'ST'. " Text ID from SO10
    GW_THEAD-TDSPRAS = SY-LANGU. "current language
    GW_THEAD-TDOBJECT = 'ZXXX'. "name of the text object created in SO10
    *To Read from Container and get data to int_table
    CALL METHOD EDITOR ->GET_TEXT_AS_R3TABLE
    IMPORTING
    TABLE = int_table
    EXCEPTIONS
    ERROR_DP = 1
    ERROR_CNTL_CALL_METHOD = 2
    ERROR_DP_CREATE = 3
    POTENTIAL_DATA_LOSS = 4
    others = 5.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop data from int_table and save to int_line-tdline appending it.
    *save the text
    CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
    HEADER = GW_THEAD
    TABLES
    LINES = InT_LINE
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    OBJECT = 4
    OTHERS = 5.
    IF SY-SUBRC 0.
    ENDIF.
    *To pass to Container
    CALL METHOD EDITOR ->SET_TEXT
    hope that the above sample with helps you solve the problem
    Please check and revert,
    Reward if helpful
    Regards
    Byju

  • How to send 2 variable value from bash script into java.class

    #!/bin/bash
      a=10
      b=20
       echo $a $b | java addition
    donehi there,
    currently i have a simple java coding ( a + b ). and i m trying to connect with bash script but this bash script coudln't Enter 2nd value (b=20) while i running for it. may i know how do i can Enter 2 value into it?
    output from terminal
    [seng@localhost java_class]$ bash addition.sh
    =======================================================================
    simulation 1
    Num_a       = 10
    Num_b       = 20
    Enter your Num_a : 10
    Enter your Num_b : Exception in thread "main" java.lang.NumberFormatException
       at java.lang.Integer.parseInt(java.lang.String, int, boolean) (/usr/lib/libgcj.so.6.0.0)
       at java.lang.Integer.parseInt(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
       at filter_god.GOD(java.util.List, java.util.List, java.lang.String, java.lang.String, int) (Unknown Source)
       at filter_god.main(java.lang.String[]) (Unknown Source)
       at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
       at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
    =======================================================================

    That code will send both numbers on a single line in standard input to the java process. So if the process reads standard input, it will get a single line that has this in it: "10 20".
    I'm guessing you're sending that whole line to Integer.parseInt. But a valid number doesn't have a space in the middle.
    You should split up the line using String.split. Or use a StringTokenizer. Or a regular expression. Or you can use a java.util.Scanner. Or a java.io.StreamTokenizer. Or maybe some other stuff that has slipped my mind at the moment.

  • [SOLVED] How To Break Up Long Statement In Bash Script?

    Hello Everyone,
      If have the following If statement in a script:
    if [[ $1 =~ ^[A-Fa-f0-9]{4,4}\:[A-Fa-f0-9]{4,4}\:[A-Fa-f0-9]{4,4}\:[A-Fa-f0-9]{4,4}\:[A-Fa-f0-9]{4,4}\:[A-Fa-f0-9]{4,4}\:[A-Fa-f0-9]{4,4}\:[A-Fa-f0-9]{4,4}$ ]]; then
    Is there any way to break this statement into multiple lines? I tried entering a \ after a portion of the statement and then pressing Enter to add a newline but it did not work.
    thriftyb
    Last edited by thriftyb (2015-04-03 21:44:13)

    Alad wrote:
    if grep -xP '(([A-Fa-f0-9]{4}):){7}(?2)' <<< "$1"; then
    http://www.regular-expressions.info/subroutine.html
    That works too. I didn't know that grep could be used that way. Thanks.

  • Open Default Email Editor with attachment

    How I open default email editor with attachment. Now I can just open the email editor with mailto,subject,body BUT i cant open it with a attachment, which is in a server.

    es5f2000 wrote:Please don't resurrect zombie threads for "me too" style posts.Hmm, I didnt know this was wrong..
    es5f2000 wrote:If you can use 1.6, Desktop.mail() will at least open the mail application, though it won't let you auto-attach. If you must use 1.5, you may have to hand-roll a solution for each environment you support. I'm not personally aware of any 1.5-compliant library that provides this functionality.Since youve replied, the 1.6 solution of opening an email but without an attachment is not good much use to me, and the creation of various support files and putting them into an attachment is the part of the process that the user has most problems with. So either I could either just create the attachment somewhere and let the customer handle the whole email side of things OR I could make use of the fact that my customers email address is embedded in their license and that an smtp server can be used to send an email from anyone, to open a form for the user to write a problem description and then send it from within my application, but the trouble with this approach is they can't have full control over the email they send.

  • HT2506 How do I change the default image editor from Preview to Graphic Converter?

    How do I change the default image editor from Preview to Graphic Converter?

    I'm assuming you want the default programme to change from Preview to Graphic Converter so that clicking on the file would open Graphic Converter instead of Preview.
    Control click on the file type that you want to open using Graphic Converter. Press Command+I for Get Info. Click on the triangle next to Open With. Select Graphic Converter and Press Change All...

  • How can i double click a box in GUI and simply open a text editor?

    My case is that in my GUI frame, i have several boxes and if i double click on them, i want to open a text editor for these boxes and write the description for them then save them, and next time when i double click again, i can reopen this editor and see the description i did.
    How can i do this? I'm stuck. If somebody can help me, i appreciate it very much!
    Thanks a lot!

    If the JOptionPane.showInputDialog is not enough then you would have to come up with your own JDialog and customize it to suit your needs.
    For the saving aspect, if the items are online strings or short items, then consider using java.util.Properties for a name=value pair saving machinism. If your strings will be multiline, then consider using a textfile for each individual string set or use XML. The java.util.Properties class in JDK 1.5 provides and very simple XML storage and load feature for storing its name=value pairs.
    Look into these and add dbulai's advice for a grand finish
    ICE

  • How to open a JSP page from a form ??? plz help

    hi ..
    i want to know how to open a jsp page from a oracle apps form using a button .
    the requirement is that whenever we click on the button created on the form, it opens a jsp page.
    plz help me ..its urgent !! :-(

    In portlet project, to navigate between pages, you should not use the URL property to link to a page. Instead, portlets use navigation via action handling. You use the Page Navigation editor to set up links to pages; that is, the navigation editor sets the action property.
    Here is an example to hyperlink ans button to open a new page:
    # From within the IDE, create a new portlet project. This action creates the project and one page, PortletPage1.jsp.
    # Create a second portlet page, called PortletPage2.jsp, for the project.
    # Drop a Hyperlink component onto the first portlet page, PortletPage1. (You can drop the Hyperlink on the page in the Design window or on the PortletPage1 node in the Outline window.) Change the Hyperlink's text property to Next Page.
    # Drop a Button component (found in the Basic section of the Palette) onto the second portlet page, PortletPage2.
    # Open the Page Navigation Editor. It displays the two pages (PortletPage1.jsp and PortletPage2.jsp) of the application.
    # Click the PortletPage1.jsp icon in the Navigation window to expand it, and then drag a connector from hyperlink1 to PortletPage2.jsp. Change the name of the connector from case1 to Page2.
    # Click the PortletPage2.jsp icon in the Navigation window to expand it, and then drag a connector from button1 to PortletPage1.jsp. Change the name of the connector from case1 to Page1.
    # Run and deploy the portlet. The browser displays PortletPage1 and you should see the Next Page hyperlink. When you click the Next Page hyperlink, the Apache Pluto Portal server displays PortletPage2. Click the Page2 button to return to PortletPage1.
    Sherry
    Creator Team

  • How to edit default text in fla file

    I'm using an open-source Flash mp3 player. In comes in two swf versions. One plays a list of songs and displays the album cover(s). The other version just plays one song. The problem is that the single-song version loads some default text that I want to change (I was able to do this in the other version via the external playlist file). I'm a Flash newbie, and when I open the fla file the player's author provides, I can't find where this default text is located. (The playlist version works fine; its default text relates to what the user will get when they click on the file titles.) Links:
    Playlist version that works OK - http://www.keithpurtell.com/kthings/fripp.htm
    Single song version with wrong default text - http://www.keithpurtell.com/kthings/bjcole.htm

    SOLUTION:
    For the benefit of anyone else using the XSPF mp3 player, here is how to change default text. The XSPF player file is deployed to your server with your target mp3 files, whatever playlists you have created, and a file ending with the .as extension. The .as file contains the default text and can be changed with a good (free) text editor like NotePad++.

  • Set default text editor (no type, creator or extension)

    I would like BBedit to be the default text editor not TextEdit.
    I work in Terminal a lot and often encounter files that were sent to me by someone using Linux and have no type, creator or extension. I want these to open in BBedit not TextEdit.
    The problem can be recreated like this:
    Create an empty file in the Terminal like this:
    %touch testfile
    Select testfile in the Finder and set BBedit as the application to open this file. Click the "Change all" button to make this global.
    I then get an error about there being not enough information. I'm given the option to update and I do.
    Then double clicking on testfile does, in fact, open the file in BBedit.
    Now the rub. If I then generate another file called testfile2 like this:
    %touch testfile2
    Testfile 2 opens in TextEdit when double clicked in the Finder.
    What am I doing wrong?

    I'm not sure how to set a default for files like that. What I do for files that aren't cooperative like that is just have BBEdit (well, actually, TextWrangler for me) on the Dock and then just drag and drop them.
    You could potentially use an AppleScript or shell script to set the creator code to 'R*ch' for a batch of files. Type and creator codes used to be the Mac's alternative to extensions, but they were unfortunately left behind in Mac OS X, since the rest of the computing world didn't understand them. There's still support for them hiding in the OS, though. Looks like there's a script that'll do the trick here:
    http://scriptbuilders.net/files/setcreatorcodeofselection1.0.html

  • Pages - Default Text Editor?

    How can I make Pages my default text editor?

    Hi DennisG,
    Thank you for the link. Now I have it, small file download. Yes it does look interesting, it will be fun to play around with getting to know it.
    On a side note to both you and Yvan: Back in my Windows days I did MS Office tech support. That caused me to became quite a Word junky creating specialty docs, brochures, and the like. With the arrival of Pages rarely do I use Word, only when someone needs assistance with a Word doc. I've moved to Pages, for what I do it's so much better than Word 2004 (don't have 2008).
    Some friends using AW want help with their AW thingys, so to assist them I reinstalled AW. Wow, I question why for years I hadn't used it: now I use AW more than Pages and Numbers. It amazes me how fast AW is, plus I like the DB as well. Yes the word processor and spreadsheet aren't as graphical as Numbers and Pages however, the print outs are very good, and both modules do numerous things Pages and Numbers yet cannot do.
    The more I use AW the more I understand why folks wished Apple, rather than start iWork from scratch, ported AW to iWork. Let's hope the next version of iWork will catch up to AW becoming the cats meow perhaps.
    Again thank you for the Bean link.
    Sincerely,
    RicD
    Sincerely,
    RicD

  • Make Pages default text editor

    How do I make Pages the default text editor? (Double click a .txt file and Pages opens instead of Appleworks)

    Hello kelwhite01,
    welcome to the Pages Discussions. Select a ".txt" Document in a Finder window and open the Infowindow for it (shortcut: "command" and "i"). In the middle of the window you see a section titled "Open with". There you can choose the app you want to open the selected document with. After choosing Pages, press the button at the bottom of the section to order the system to open every document of that type with Pages.

  • How to upload a text file from a shared folder and provide an o/p

    how to upload a text file from a shared folder and provide an o/p  containing the details in each order in the text file

    Hi,
    Use <b>GUI_UPLOAD</b> to upload a text file from a shared folder.
    Use <b>GUI_DOWNLOAD</b> to download data in a file on the presentation server or use <b>OPEN DATASET, TRANSFER</b> and <b>CLOSE DATASET</b> statements to download data to the application server.
    Now, I hope the code for data fetching, if required, is already present in the report.
    Reward points if the answer is helpful.
    Regards,
    Mukul

  • How can i print text messages from my htc amaze to my deskjet 3050A

    how can i print text messages from my htc amaze to my hp deskjet 3050A

    Hi,
    I believe the phone uses Android OS, v2.3.4 (Gingerbread) therefore you can use one of these applications:
       http://www.printeron.com/apps/androidprinting.html
       https://market.android.com/details?id=com.pauloslf​.cloudprint&hl=en
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How to open Adobe Reader file from another native IOS application?

    There is an existing thread, but I want to re-open it because I think this is an important feature that we need badly.  I was wondering if there is any plan to add this feature so we can open PDFs directly into Adobe from the web / other apps.
    How to open Adobe Reader file from another native IOS application?
    Basically, we just want to use a custom URL scheme to open a specific document in the App.  Currently, this only opens the app but does not load the file.
    APB

    Not to hijack the conversation but I can explain why this would be useful for both the above case and another.
    What I believe Pavel is talking about is setting up a "URL Scheme" for the Adobe Acrobat iOS application so that you can easily open a PDF specifically in Adobe Acrobat iOS from other native applications and even from web applications opened within Safari. This is particularly useful if your application requires some of the specific features in Adobe Reader iOS to grant them the best experience possible and you want to encourage this.
    Another case: If you're using Adobe Livecycle's document security modules (that encrypts PDF files so that Adobe Acrobat must "phone home" to decrypt and view the document), these PDF's can only be viewed inside the Adobe Acrobat application and appear as blank in most other PDF readers. Having a URL scheme allows your application utilising this functionality to have a 1 click step to view the PDF rather than the current non-user friendly process:
    - Within Safari, touch the PDF link (appears as blank in the default Safari PDF reader, which in itself is confusing)
      - Touch "Open in..."
      - Touch "Adobe Acrobat"
    We have an immediate need for this functionality for the example above. I can resubmit it in a separate post if necessary.

Maybe you are looking for