[ale] Question about scripting...

Geoffrey lists at serioustechnology.com
Mon Aug 10 08:47:37 EDT 2009


Can't do that.  What I'd suggest though, is if you need perl, do it all 
in perl.  Anything you can do with shell you can do with perl.  If you 
have to rely on the shell, you can always open a pipe in perl and 
process shell commands, or use the '`' syntax:

my $date = `'date`;


Chuck Payne wrote:
> Sorry if this question seem a bit silly, but I am still very much a
> newbie when it come some to scripting.
> 
> I want to write a shell script that does some scp of files, but I like
> to use both bash and perl. Could I do some thing this,  how would I
> got about mixing shell, python, perl and other things with in a
> script.
> 
> #!/bin/bash
> 
> workdir=/tmp
> file="`hostname`.`date +%m%d%Y`.tgz"
> 
> # Functions
> 
> scpjvm () {
> 
> #!/usr/bin/perl -w
> 
> use Net::SFTP;
> use strict;
> 
> my $host = "mars.myhost.com";
> my %args = (
>     user => 'toor,
>     password => '1234567',
>     debug => 'true'
> );
> 
> my $sftp = Net::SFTP->new($host, %args);
> $sftp->get("/tmp/'jvm.`hostname`.`date +%m%d%Y`.tgz'",
> "/home/ia/'jvm.`hostname`.`date +%m%d%Y`.tgz'");
> 
> 
> }
> 
> # The work
> 
> cd $workdir
> 
> tar czvfpP $file  /etc/httpd /opt/jboss/jboss/bin/
> /opt/jboss/jboss/server /usr/local/bin --exclude *log* --exclude
> *nohup*
> 
> scpjvm
> 
> rm  $file
> 


-- 
Until later, Geoffrey

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
  - Benjamin Franklin


More information about the Ale mailing list