[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: Backup and Incremental Backup Perl Scripts

From: Gavin Henry <ghenry_at_suretecsystems.com>
Date: 2005-05-24 10:26:06 CEST

<quote who="Edward Q. Bridges">
> You're mixing up bash syntax with perl.
>
> If you're using bash, you can do this:
>
> #!/usr/bin/bash
>
> #Note, no leading '$'
> var1=$1;
> var2=$2;
>
> echo $var1
> echo $var2
>
>
> If you're using perl, it uses a different syntax for retrieving cmd line
> parameters:
>
> #!/usr/bin/perl
>
> $var1 = $ARGV[0]
> $var2 = $ARGV[1]
>
> print "$var1\n$var2\n";

Make sure you add:

use warnings;
use strict;

to the above perl, or any perl code for that matter, like so:

#!/usr/bin/perl
use warnings;
use strict;

my $var1 = shift @ARGV;
my $var2 = shift @ARGV;

print "$var1\n$var2\n";

>
> HTH
> --e--
>
> --
> Edward Q. Bridges
> http://www.eqbridges.com/contact
>
> <quote who="Hughes, Trystan">
>>
>>>Here's what I use:
>>>#!/bin/bash
>>
>>>REPOS=$1
>>>REV=$2
>>
>>>BACKUP_DIR=/var/backups/subversion
>>>FILENAME="$BACKUP_DIR/$REV-"`/bin/date +'%F-%H%M.incr.gz'`
>>
>>>`svnadmin dump $REPOS --revision $REV --incremental | gzip > $FILENAME`
>>
>>>This gets called from the post-commit hook script like so:
>>
>>>/usr/lib/subversion/hook-scripts/incremental-backup.sh "$REPOS" "$REV"
>>
>> Ok, I am having some problems with this.
>>
>> I have created a simple perl (.pl) file that is to take the command-line
>> parameters and print them to the screen. Now my perl file I have created
>> is as follows...
>>
>> #! perl (using Windows)
>>
>> $var1=$1;
>> $var2=$2;
>>
>> print $var1."\n".$var2;
>>
>> And the command-line call that calls this script is as follows...
>>
>>>perl c:\test_incremental.pl "param1" "param2"
>>
>> Now it compiles ok, but all I get is blank output to the command prompt
>> when I run the script, and not
>>
>> param1
>> param2
>>
>> Hope someone can see where I am going wrong or missing something out.
>>
>> Thanks
>>
>> Tryst
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue May 24 10:29:23 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.