Results 1 to 5 of 5
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. ...
- 02-28-2009 #1Just Joined!
- Join Date
- Feb 2009
- Posts
- 2
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.
Code:echo Start running script echo ##### Setting variables ##### set MY_PATH=/opt/MYDir/bin set LOG_HOME=/opt/MYDIR/logs cmd /c "%MY_PATH%/setVars.sh" 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 com.my.company.JavaClass -option1 HELLO -option2 "my-rule.xml" >> %LOG_HOME%\MY_data.log
Thanks.
Bye,
Viki.
- 02-28-2009 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
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
and
Converting DOS Batch Files to Shell Scripts
- 02-28-2009 #3Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
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.
DOSBash (Unix/Linux)Code: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.logI'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!Code:echo Début\ -\ $(date +%d/%m/%Y) > $LOG_HOME/MY_data.log
- 03-01-2009 #4Just Joined!
- Join Date
- Feb 2009
- Posts
- 2
thanks for the help.
- 03-15-2009 #5
Passing commands to Linux from MS Bat file
Hi
thought I was createting a new post sorry.


Reply With Quote