Unix iTOps Tube

Wednesday, May 16, 2012

Batch to Shell Question??

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:



set OK=N

set CUR_DIR=%~dp0

set CURRENT_TIME=%TIME:~0, 1%%TIME:~1,1%%TIME:~3,2%%TIME:~6,2%%TIME:~9,2%

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...


export LC_ALL=C

export OK=N

export CUR_DIR=$(dirname $0)

export CURRENT_TIME=$(date "+ %H%M%S")

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...


No comments:

Post a Comment