How to save a shell script file (.sh file) with DOS line endings as Unix/Linux file?

How to save a shell script file (.sh file) with DOS line endings as Unix/Linux file?

13
Basic UserBasic User
13

    Jan 13, 2022#1

    Hi,

    I've searched around and found lots of info about configuration items, and how to deal with Unix line ending type.  But I found nothing about how to save an existing .sh file with DOS line endings as a Unix file.

    The UltraEdit Wiki page Converting file encoding describes multiple conversion options with the active file.  But in the UEStudio menu (not ribbon) that I have, the Conversions option has only four choices:
    • Use IBM-500 standard for EBCDIC
    • Do not convert returns ...
    • On paste convert  line endings to destination type (Unix/Mac/DOS)
    • Prompt to convert active file to ...
    The DOS/Unix/Mac handling items don't provide an option to change the active file to Unix/Linux.

    I'm trying to use the .sh file and test a script within Windows 10 bash.  But it's giving me errors regarding the line endings, because it's using a DOS carriage return/line feed format.  I need the file with Unix/Linux line ending type (only line feed).

    6,686585
    Grand MasterGrand Master
    6,686585

      Jan 13, 2022#2

      There are multiple methods to convert a text file with DOS/Windows line endings (carriage return + line-feed) to a text file with Unix line endings (just line-feed).

      One method is using the command Save as (key F12), clicking on the down arrow right to the button Save and clicking on Save (Unix line ends - LF).

      Another one is clicking with secondary (right) pointing device (mouse) button on the file tab of the active file and clicking in opened file tab context menu in submenu Conversions on the menu item DOS to Unix.

      On using the ribbon interface mode there can be clicked on last ribbon tab Advanced in second group Active file on the item Conversions to open the popup menu with third item DOS to Unix. The key sequence to execute this command by keys is left Alt+A, I, U or left Alt, A, I, U.

      In toolbar/menu mode with contemporary menus can be clicked in last but one main menu Advanced in submenu Conversions on menu item DOS to Unix, key sequence left Alt+A, I, U or left Alt, A, I, U

      In toolbar/menu mode with traditional menus can be clicked in first main menu File in submenu Conversions on menu item DOS to Unix. Key sequence is not really possible as there are two menu items with i as mnemonic key in menu File, Conversions and Recently opened files. There is always selected Recently opened files on pressing key I after pressing Alt+F.

      In the Key mapping configuration dialog can be assigned also a hotkey or chord to command DOS to Unix for even a faster execution of this command by key on being needed often.
      Best regards from an UC/UE/UES for Windows user from Austria

      13
      Basic UserBasic User
      13

        Jan 13, 2022#3

        All set, thanks Mofi.