Batch to Shell Issue: What's the correct equivalent of setlocal in Shell Script...
I know this is kindof a noob question, but Im trying to convert a simple batch file to shell, but Im new to shell scripting.
What would the following be in shell script:
I've read up on setlocal and ~dp0 conversions to shell but I'm not sure... Also, Im not sure what set OK=N actually does.
But this is what I've come up with...
Not Sure if its correct at all because Im not sure what setlocal and OK=N is actually doing on a windows machine vs mac/unix.
Also, couldn't figure out how to get the milliseconds in there like the batch file...
Any help would be appreciated...
Thanks
Last edited by scrumx; 05-12-2012 at 03:25 PM..
Reason: update title
Why does the script need time to miliseconds? I suspect it's attempting to generate a unique temporary file, in which case the unix mktemp command is preferable.
If you really need time with ms and you have gnudate you can do:
MSDOS setlocal has nothing to do with locale, it controls the scope of environment changes not language stuff.
Last edited by Chubler_XL; 05-13-2012 at 09:34 PM..
So basically to give you and everyone a little background on the entire script is that it is a setup script that downloads and unzips things like eclipse, maven, apache, tomcat, etc... and places them in their correct directories so that when the script runs once; the development environment is setup for any new user...
That said your response makes sense and is very appreciated...
I also figured out what the OK=N is with the help of a question I posted in stackOverflow, basically in the batch script it was a variable that was created for debugging purposes only...
I am currently migrating to ubuntu from my windows system. Now I am learing to convert all my batch scripts into linux shell. Although the common commands are more or less similar, but I found it difficult for the following set of commands in windows cmd:
setlocal
:PROMPT
SET /P... (2 Replies)
Hi All,
I have a small tool which is currently configured in batch scripts only. But my need is to run it on Linux platform, so I have been trying to convert a batch script to shell script.
below is the batch script:
@echo off
IF "%1"== "" GOTO ARGERR
REM UPDATE THESE PROPERTIES TO... (2 Replies)
Hi,
I am a junior dba and started carrier very new. I have a batch file to create some script of db creation. I want that batch file to convert in .sh file so that I can directly run that in the AIX box to generate those files.
Please help me with the code for AIX. Batch file is here:
... (2 Replies)
Hi All,
I am working on shell scripting.My script is completed but I have one task that is to trigger the batch script(with or without parameter) from my shell scripting(reside on linux system) and output which is geneareted by the batch should e.g. if batch script creates any files then I want... (5 Replies)
while converting batch file to shell script ...dis command is ther i dunno how to change...can anyone knws how to change into shell script
rm !(D:\temp\XX.txt) (3 Replies)
Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below.
I am on a solaris server btw.
Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose.
... (2 Replies)
Hi.
I am trying to write an sh script that will:
1. take each wav file in ~/Documents
2. convert each into mp3 format using "lame" encoder
3. save the new mp3 in ~/Documents/newmp3s.
It has to follow the 3 steps in this order for each wav file before taking the next file.
I tried a... (8 Replies)
EDIT: Is this wrong thread?
Hi I am on an Apple Mac and I am trying to run this batch file on my Mac and was wondering if anyone could tell me what a script that will make this run and work on my Mac. I was hoping that you could tell me the script in the shell format?
So here's the batch... (4 Replies)
How do I execute a batch command from a script, which "waits" with the next command until the first one has finished?
=======
A piece of my script looks like this:
#!/bin/sh
(...)
# run a long batch job:
./run_calculation.sh
# then rename resulting file:
mv output.dat backup.dat
(...)
... (7 Replies)