Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've googled, I've read, I'm coming up blank. I'm editing a batch file to do a mass SVN dump and load. As all good developers do, I have a script that I acquired, but I'd like to understand all of it. Basically, the script iterates through the list of repositories:

FOR /F %%G IN ('dir /b /ad %repodir%') DO ^
SET dumpfile=%%G.dump
ECHO Starting SVN dump for %%G... >> %repolog% & ^

svnadmin dump %repodir%%%G > %repotdirdump%%%G & ^


The question - See the caret and the "& ^"? What do these do? Is this how the for loop is defined?

thanks
Posted

its odd - '&' is usually used as

statement1 & statement2

meaning statement2 will run after statement1

then you can have

statement1 && statement2

(note double &&) - which iirc means statement2 will run only if statement1 is successful

so far so good.. the caret aka '^' usually 'escapes' the character following it, that is, stops the character being interpreted by the shell, but in the sense you've shown I find it hard to make sense of

you can of course use

...DO (
statement1
..
statementn
)

but that might change the meaning of what's intended - sorry I cant help more Charlie, its been a long, long time (and we had quite sophisticated batch scripts even for our time)
 
Share this answer
 
v2
Comments
Richard MacCutchan 9-Dec-14 12:32pm    
What happens when you run it?
charlieg 9-Dec-14 17:57pm    
Well, it takes the data from the FOR command and pipes it. Beating on this thing all day, it's clear it's a line continuation approach. Script is running now, this should be fun.
You know, I think you're on to something. I think it's sort of like a continuation. The "^" is the escape character, and it's there to allow ignoring the new line- I think.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900