Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    converting windows script into Linux?

    Hello all,

    This is my first post in this forum. And I am a complete novice in linux scripting.

    I have a windows script which runs successfully in win env. Now I want to run this same script on Linux. If somebody can convert below win script into Linux then it would be great.

    echo Start running script
    echo  ##### Setting variables #####
    set MY_PATH=/opt/MYDir/bin
    set LOG_HOME=/opt/MYDIR/logs
    cmd /c "%MY_PATH%/"
    for /f " tokens=1,2,3 delims=/ " %%i in ('date /t') do (
      set dd=%%i
      set mm=%%j
      set YY=%%k
    for /f " tokens=1,2,3 delims=: " %%i in ('time /t') do (
      set xx=%%j
      set hh=%%i
      set zz=%%k
    echo Début - %dd%/%mm%/%YY% à %hh%h%xx% > %LOG_HOME%\MY_data.log
    echo  ##### Creating FUNCTION please check log at >> %LOG_HOME%\MY_data.log #####
    cmd /c "%MY_PATH%\some-command -c updater.dtd -f my-categories.xml" >> %LOG_HOME%\MY_data.log
    echo  ##### Creating Rules please check log at >> %LOG_HOME%\MY_data.log#####
    cmd /c java -option1 HELLO -option2 "my-rule.xml" >> %LOG_HOME%\MY_data.log



  2. #2
    Sorry but we're not here to do your work. If you run into a specific problem we'll help you. These sites should help:

    Linux/UNIX For DOS Users


    Converting DOS Batch Files to Shell Scripts

  3. #3
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    A point of note: DOS Date setting is a pain and quite old fashioned. The date command in Unix is a lot better for specifying what you want and better yet it can be embedded directly into a command.

    for /f " tokens=1,2,3 delims=: " %%i in ('time /t') do (
      set xx=%%j
      set hh=%%i
      set zz=%%k
    echo Début - %dd%/%mm%/%YY%  > %LOG_HOME%\MY_data.log
    Bash (Unix/Linux)
    echo Début\ -\ $(date +%d/%m/%Y) > $LOG_HOME/MY_data.log
    I've trimmed it a bit, it's just to give you a start. The link to the Advanced Bash Scripting guide above is the best place to start. If you understand DOS/NT command scripts you should take to it very quickly. The only problemwill be understanding how much more powerful BASH is compared to DOS!

  4. $spacer_open
  5. #4
    thanks for the help.

  6. #5
    Just Joined! Dingo001's Avatar
    Join Date
    Apr 2008

    Passing commands to Linux from MS Bat file


    thought I was createting a new post sorry.

Posting Permissions

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