I have a script ( source ) to parse svn info in order to create a suitable string for Bash $PS1 . Unfortunately, this does not work on the same system I use Perl 5.8.8 on. It prints all lines instead of matches. What would Perl 5.8.8 be equivalent to the following?
__svn_ps1() { local result=$( svn info 2>/dev/null | \ perl -pe 's;^URL: .*?/((trunk)|(branches|tags)/([^/]*)).*;\2\4 ;p') if [ -n "$result" ] then printf "${1:- (%s)}" $result fi }
The result from Perl 5.10 contains only a space, brackets, a single branch name, a tag or trunk name, and an ending bracket. Exiting Perl 5.8.8 (without final p ) contains this plus version in brackets of each space-separated portion of svn info output.
A possible workaround involves a simple grep '^URL: ' between the svn and perl commands, but I was hoping to avoid this, as this will be done for every Bash hint.
source share