In developing with SVN, sometimes I want to just rollback all my changes and start fresh, so I put together a command to revert all the files in my checkout:
alias "svn-reset"="svn status | perl -nale 'print $F[1] if /^M/' | xargs svn revert"
When I run svn status | perl -nale 'print $F[1] if /^M/' | xargs svn revert on the command line, the code works as expected: all my modified files get reverted, as verified with another svn status command. However, when I run svn-reset, I get output like the following:
$ svn-reset
Skipped 'ARRAY(0x1c2f52a0)'
Skipped 'ARRAY(0x1c2f5450)'
Skipped 'ARRAY(0x1c2f5410)'
In this example, I’ve verified that I have three modified files in my checkout, so it looks like the problem is with perl printing out the wrong information. However, I know hardly any perl, and I’m stumped as to why perl would behave differently run through a bash alias as compared to running the same perl code manually. Any thoughts?
This question is about why perl behaves differently when run using a bash alias. If anyone has any suggestions for a more efficient way to automatically revert all modified files in SVN, I’d be interested in that too, but that doesn’t answer my question.
Try escaping the dollar, so that the shell does not substitute
$Fwith nothing when you create the alias: