Hi,
I'm stuck on what's the best way to automate the following set of commands in perl:
cvs login Logging in to :pserver:ebizadmin@localhost:2401/usr/local/cvsroot CVS password: cd /home/js/apache/dd cvs import -m \"First configuration\" apache/dd ebizadmin start
I started a perl script using Expect, and managed to get as far as logging into cvs, but then wasn't sure how to run the cd, and cvs import commands (Sorry haven't used Expect before). This is as far as I've got but obviously it doesn't work:
#!/usr/bin/perl use Expect; #$Expect::Debug = 1; my $cvsroot=":pserver:ebizadmin@localhost:/usr/local/cvsroot"; my $password="secret"; $timeout=3; my $exp = Expect->spawn("cvs login") or die "Cannot spawn cvs login: $ +!\n";; my $spawn_ok; $exp->expect($timeout, [ 'CVS password: $', sub { my $fh = shift; print $fh "$password\n"; print $fh "cd /home/js/apache/dd\n"; print $fh "cvs import -m \"First configuration\" apa +che/dd ebizadmin start"; exp_continue; } ], [ timeout => sub { die "No login.\n"; } ]
Any pointers on the right way to do this would be much appreciated. By the way, the Cvs module on cpan doesn't do cvs import before tells me to use that!
Many thanks,
js.
In reply to automating some cvs commands by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |