in reply to dos2unix line endings on Windows

You clobber the caller's PERLIO. Fixed:

@echo off if "%1"=="" goto usage setlocal set PERLIO=perlio for /r %1 %%X in (*.*) do ( perl -pi.bak -e "s/\r\n/\n/g" "%%X" del "%%X.bak" ) goto bye :usage echo. echo USAGE: %0 directory echo. :bye

Replies are listed 'Best First'.
Re^2: dos2unix line endings on Windows
by flamey (Scribe) on Feb 11, 2010 at 17:26 UTC
    I usually try to return things to their original state, that's why I did it. I think when you run this file in an open CMD session, the PERLIO will remain set after batch file execution. but you may not want it in the consequent Perl one liners.

      I think when you run this file in an open CMD session, the PERLIO will remain set after batch file execution.

      Correct. So if it was PERLIO=foo before your batch file ran, you changed it to PERLIO=.

      I usually try to return things to their original state, that's why I did it.

      Except it didn't return it to its original state. The change I made returns it to its original state.

        i didn't notice setlocal. i'll correct my original post. tnx