[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cp sucks or do I not know enough?



We converted many production shell scripts to dos/windows batch scripts...
(We had to make it possible to run our medical applications under windows...) It was no easy task... We still have no reasonable method to create symbolic links...

Things like:
GDATE=`date +%Y%m%d`

Look like:
for /f "tokens=1-4 delims=/.- " %%A in ('date /t') do (set DOW=%%A&set MM=%%B&set DD=%%C&set YYYY=%%D)
set GDATE=%YYYY%%MM%%DD%

Batch syntax and functionality just isn't nearly as rich and compact as shell, so after you become familiar with the power of shell scripting, you'll find that you install C:\bin, put it in your PATH and fill it full of things like vi.exe, tr.exe, sed.exe, today.exe, etc. that you can locate on the web to make batch scripting much easier.

If you use today.exe to get the same result, the batch script looks like:
for /f "tokens=1 delims= " %%A in ('today') do (set GDATE=%%A)
Still not as intuitive as VAR=`the output of the execution of this program`,
but it does the same thing.

So... as you work in shell, start building your C:\bin library. You'll be glad you did!

Larry Irwin
V.P. Development
CCA Medical



Reply to: