Thread: Help converting bash shell script to windows

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    1

    Post Help converting bash shell script to windows

    pl. help me to write the following linux programme in to windows base
    OS or C or C++

    Code:
    value=0
    set `date`
    while [ $value -ne 5 ]
    do
    clear
    tput smso
    echo "DOTWARE             AHMEDABAD TELECOMM DISTRICT              DATE : $2 $3 $6" 
    tput rmso                                         
    echo     
    echo     
    echo     
    echo "COMPUTER CELL          TR-BILL ACTIVITY MENU                 TIME : $4"
    echo "                       -------------------------"                     
    echo     
    echo                                              
    echo                                              
    echo "                 1)   [    5 E S S  Stream-0             ]"
    echo                                              
    echo                                            
    echo "                 2)   [    5 E S S Meter Tape            ]"                       
    echo                                            
    echo "                 3)   [    Tranfer File TO TR-BILL       ]"                       
    echo                                            
    echo "                 4)   [    Copy Stream-0 File from IOBAS ]"                       
    echo                                            
    echo "                 5)   [    Exit                          ]"
    echo                                            
    echo                                            
    echo -n  "                 Enter choice 1 - 5 :   "  
    read choice
    echo
    case "$choice" in
        1)clear
              echo "       5-ESS  stream-0 DAT dump into the Computer          :"
    echo
              cd /home/detail/data
              dd if=/dev/nst0 of=/home/detail/data/yy conv=ascii
              dd ibs=10000 conv=ascii if=/dev/nst0 of=/home/detail/data/ama
              echo "       Enter input-File Name  :"
              read x
              echo "       Enter Output-File Name :"
              read y
              mv $x $y                
              read h
          sleep 2
          ;;
        2)clear
              echo "       5-ESS  Meter Tape  Converted in to TEXT Format :"
    echo
              cd /home/detail/data
              dd ibs=10000 if=/dev/nst0 of=/home/detail/data/mul 
              dd if=/dev/nst0 of=/home/detail/data/yy
              echo "       Enter input-File Name  :"
              read x
              echo "       Enter Output-File Name :"
              read y
              mv $x $y
              read I
          ;;
        3)clear
              echo "       5-ESS transfer to TR-BILL Server              :"
              cd /home/detail/data     
              ls -l
              ftp 10.72.2.173
               
          ;;
            4)clear
              echo "       Copying Stream-0 File from IOBAS              :"
              cd /home/iobas/Cdr_Completed
              ls -l
              echo "       Enter the File Name to be Copied              :"
              read l
              cp /home/iobas/Cdr_Completed/$l /home/detail/data
              cd /home/detail/data
              ls -l
              echo "       Enter Output File Name                        :"
              read n
              mv $l $n
              ls -l
          ;;
            5)clear
              exit;;
    esac
    done
    Last edited by Salem; 11-24-2011 at 02:08 PM. Reason: tagged and meaningful title

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I won't bother with the basics of C or C++ such as how to print to the console or get user input since you can easily learn those yourself (and if you can't do that, quit now). Ditto for flow control and file IO (mv, dd, etc).

    But I will give you some clues about other things:

    tput -- adding bold, etc, can be accomplished by putting ANSI escape sequences into the output stream:
    ANSI escape code - Wikipedia, the free encyclopedia

    cd == chdir

    clear -- use system()

    ls -- Accessing Directories - The GNU C Library

    ftp -- you could use libcurl - the multiprotocol file transfer library
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > dd ibs=10000 if=/dev/nst0 of=/home/detail/data/mul
    > dd if=/dev/nst0 of=/home/detail/data/yy
    I guess the fun will really start when you try to read tapes produced on a "*ix" machine using your windows box.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Tags for this Thread