Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts

    Looking for help converting a .bat to .sh

    I have spent ages on Google trying to convert the code

    But i have found guide to the different programs but they just don't help for what i'm doing as i have a complex .bat file this is for a new control system i am working on its like cpanel but i want it for windows as well but i have not built the installing bit of it only the options but the installing bit is really easy yum lol and for widows well run the installers

    Code:
    @echo off
    :mainmenu
    CLS
    echo  ##############################################################################
    echo  ##############################################################################
    echo  ##                        Welcome to PhdPanel Installer                     ##
    echo  ##                          1. Install Recomended                           ##
    echo  ##                          2. Install No MySQL                             ##
    echo  ##                          3. Install No DNS                               ##
    echo  ##                          4. Custom Install                               ##
    echo  ##                          5. Read Me File                                 ##
    echo  ##                          6. Terms                                        ##
    echo  ##############################################################################
    echo  ############################################################################## 
    GOTO inputloop  
    
    :inputloop
    echo  Please use options above
    SET /p choice=
    IF %choice% == 1 GOTO Option1
    IF %choice% == 2 GOTO Option2
    IF %choice% == 3 GOTO Option3
    IF %choice% == 4 GOTO Option4
    IF %choice% == 5 GOTO Option5
    IF %choice% == 6 GOTO Option6
    IF %choice% == EXIT EXIT
    GOTO mainmenu
    @pause
    
    :Option1 
    echo Sorry Installer Not Created yet
    echo Installer Begining 
    echo yum install -y httpd php apache mysql php-mysql mysql-admin mysql-server vsftp name caching-nameservers sendmail
    @pause
    EXIT
    
    :Option2 
    echo Sorry Installer Not Created yet
    echo Installer Begining 
    echo yum install -y httpd php apache php vsftp name caching-nameservers sendmail
    @pause
    EXIT
    
    :Option3
    echo Sorry Installer Not Created yet
    echo Installer Begining 
    echo yum install -y httpd php apache php-mysql vsftp sendmail mysql php-mysql mysql-admin mysql-server
    @pause
    EXIT
    
    :Option4
    GOTO startcustom
    EXIT
    
    :Option5
    CLS
    echo  ##############################################################################
    echo  ##############################################################################
    echo  ##           This is the Readmore Section Copyright of martin barker        ##
    echo  ##                           and Richarch Dickinson                         ##
    echo  ##############################################################################
    echo  ##############################################################################
    @pause
    GOTO mainmenu
    
    :Option6
    CLS
    echo  ##############################################################################
    echo  ##############################################################################
    echo  ##                         The Terms and conditions                         ##
    echo  ##############################################################################
    echo  ##############################################################################
    @pause
    GOTO mainmenu
    
    :startcustom
    SET co1=on
    SET co2=on
    SET co3=on
    SET co4=on
    SET co5=on
    SET co6=on
    SET co7=on
    GOTO customdraw
    
    :switch1
    IF %co1% == on GOTO sw1n
    IF %co1% == off GOTO sw1f
    
    :sw1n
    SET co1=off
    GOTO customdraw
    
    :sw1f
    SET co1=on
    GOTO customdraw
    
    :switch2
    IF %co2% == on GOTO sw2n
    IF %co2% == off GOTO sw2f
    
    :sw2n
    SET co2=off
    GOTO customdraw
    
    :sw2f
    SET co2=on
    GOTO customdraw
    
    :switch3
    IF %co3% == on GOTO sw3n
    IF %co3% == off GOTO sw3f
    
    :sw3n
    SET co3=off
    GOTO customdraw
    
    :sw3f
    SET co3=on
    GOTO customdraw
    
    :switch4
    IF %co4% == on GOTO sw4n
    IF %co4% == off GOTO sw4f
    
    :sw4n
    SET co4=off
    GOTO customdraw
    
    :sw4f
    SET co4=on
    GOTO customdraw
    
    :switch5
    IF %co5% == on GOTO sw5n
    IF %co5% == off GOTO sw5f
    
    :sw5n
    SET co5=off
    GOTO customdraw
    
    :sw5f
    SET co5=on
    GOTO customdraw
    
    :switch6
    IF %co6% == on GOTO sw6n
    IF %co6% == off GOTO sw6f
    
    :sw6n
    SET co6=off
    GOTO customdraw
    
    :sw6f
    SET co6=on
    GOTO customdraw
    
    :switch7
    IF %co7% == on GOTO sw7n
    IF %co7% == off GOTO sw7f
    
    :sw7n
    SET co7=off
    GOTO customdraw
    
    :sw7f
    SET co7=on
    GOTO customdraw
    
    :custominstall
    echo Sorry Installer Not Created yet
    echo Installer Begining 
    echo yum install -y 
    @pause
    EXIT
    
    :customdraw
    CLS
    set Cchoice=Install
    echo  ##############################################################################
    echo  ##############################################################################
    echo  ##                   Welcome to PhdPanel Custom Installer                   ##
    IF %co1% == on echo  ##                     1. Apache                   [%co1%]                     ##
    IF %co1% == off echo  ##                     1. Apache                   [%co1%]                    ##
    IF %co2% == on echo  ##                     2. Httpd                    [%co2%]                     ##
    IF %co2% == off echo  ##                     2. Httpd                    [%co2%]                    ##
    IF %co3% == on echo  ##                     3. php-mysql                [%co3%]                     ##
    IF %co3% == off echo  ##                     3. php-mysql                [%co3%]                    ##
    IF %co4% == on echo  ##                     4. php(no SQL)              [%co4%]                     ##
    IF %co4% == off echo  ##                     4. php(no SQL)              [%co4%]                    ##
    IF %co5% == on echo  ##                     5. ftp                      [%co5%]                     ##
    IF %co5% == off echo  ##                     5. ftp                      [%co5%]                    ##
    IF %co6% == on echo  ##                     6. DNS                      [%co6%]                     ##
    IF %co6% == off echo  ##                     6. DNS                      [%co6%]                    ##
    echo  ##                                                                          ##
    echo  ##                       Press Return to Install                            ##
    echo  ##############################################################################
    echo  ############################################################################## 
    echo Please use options above
    SET /p Cchoice=
    IF %Cchoice% == 1 GOTO switch1
    IF %Cchoice% == 2 GOTO switch2
    IF %Cchoice% == 3 GOTO switch3
    IF %Cchoice% == 4 GOTO switch4
    IF %Cchoice% == 5 GOTO switch5
    IF %Cchoice% == 6 GOTO switch6
    IF %Cchoice% == 7 GOTO switch7
    IF %Cchoice% == Install GOTO custominstall
    IF %Cchoice% == EXIT EXIT
    GOTO customdraw
    BTW wasn't joking when i said it was complex

    P.S sorry if this is in the wrong place
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)

  • #2
    New Coder
    Join Date
    Mar 2005
    Location
    Indiana (USA)
    Posts
    50
    Thanks
    4
    Thanked 0 Times in 0 Posts
    A .sh file in linux can actually use many different shells. But you are probably wanting either bash or perl. If you use perl the program could also be used on Windows if perl is installed (yes, perl can be used for command line work).

    Since I am guessing you want bash here is a website that I found that looks like it might be helpful:

    http://www.hypexr.org/bash_tutorial.php

    Also, here are 2 powerpoints posted by some professor that I found. I have used these before:
    http://csserver.evansville.edu/~rich...03_BASH_1.html

    http://csserver.evansville.edu/~rich...04_BASH_2.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •