[ale] Question about scripting...
Matt Rideout
mrideout at windserve.com
Mon Aug 10 09:50:40 EDT 2009
My suggestion is to do as much as you can in Perl, and when you do need
to call a command, use system(). For example:
systems(ls);
You could accomplish the reverse with perl -e. For example:
perl -e 'print "hello world\n"'
Chuck Payne wrote, On 08/10/2009 08:28 AM:
> 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
>
>
More information about the Ale
mailing list