Results 1 to 5 of 5
|
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
-
02-28-2009 #1
- Join Date
- Feb 2009
- Posts
- 2
converting windows script into Linux?
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 #2
- 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 #3
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.
DOSCode: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
Code:echo Début\ -\ $(date +%d/%m/%Y) > $LOG_HOME/MY_data.log
-
03-01-2009 #4
- 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.