Tuesday, February 06, 2007

switching between bash and batch scripts.

Were it only as easy as s/sh/tch/! Well, it almost is.

For the most part only a few search replaces are required. Most of the tme I need to convert a dos batch to a bash script. The first round of conversion includes:

:set ft=unix
:%s/%\(\w\+\)%/$\1/g
:%s/set //ig
:%s/rem/#/ig
:%s/;/:/g
:%s/\\/\//g

There is always additional work to do, but these replaces do most of the tedious portion for me.

No comments: