Chuck,<div><br></div><div>You really can't mix together several different languages in the same script file. What you can do is write one overarching script that then executes scripts from other files. So in the example you provide below, do something like put your perl bits in another file, and have it take some files as a command line argument. Also, if you want the perl script to run faster, perl has it's own hostname and date functions, by embedding the shell call for hostname and date you're having to create a bash process and execute the `quoted` command for each instance of that command. On one or two short runs, probably not a problem, but for things like perl web apps or other programs that are executed many times, that overhead adds up.</div>
<div><br></div><div>Best Regards,</div><div><br></div><div>Scott<br><br><div class="gmail_quote">On Mon, Aug 10, 2009 at 8:28 AM, Chuck Payne <span dir="ltr"><<a href="mailto:terrorpup@gmail.com">terrorpup@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Sorry if this question seem a bit silly, but I am still very much a<br>
newbie when it come some to scripting.<br>
<br>
I want to write a shell script that does some scp of files, but I like<br>
to use both bash and perl. Could I do some thing this, how would I<br>
got about mixing shell, python, perl and other things with in a<br>
script.<br>
<br>
#!/bin/bash<br>
<br>
workdir=/tmp<br>
file="`hostname`.`date +%m%d%Y`.tgz"<br>
<br>
# Functions<br>
<br>
scpjvm () {<br>
<br>
#!/usr/bin/perl -w<br>
<br>
use Net::SFTP;<br>
use strict;<br>
<br>
my $host = "<a href="http://mars.myhost.com" target="_blank">mars.myhost.com</a>";<br>
my %args = (<br>
user => 'toor,<br>
password => '1234567',<br>
debug => 'true'<br>
);<br>
<br>
my $sftp = Net::SFTP->new($host, %args);<br>
$sftp->get("/tmp/'jvm.`hostname`.`date +%m%d%Y`.tgz'",<br>
"/home/ia/'jvm.`hostname`.`date +%m%d%Y`.tgz'");<br>
<br>
<br>
}<br>
<br>
# The work<br>
<br>
cd $workdir<br>
<br>
tar czvfpP $file /etc/httpd /opt/jboss/jboss/bin/<br>
/opt/jboss/jboss/server /usr/local/bin --exclude *log* --exclude<br>
*nohup*<br>
<br>
scpjvm<br>
<br>
rm $file<br>
<br>
--<br>
----------------------------------------<br>
Old utilities do not die they just slowly fade away!<br>
-----------------------------------------<br>
OpenSUSE -- <a href="http://en.opensuse.org/User:Terrorpup" target="_blank">http://en.opensuse.org/User:Terrorpup</a><br>
OpenSuSE Ambassador<br>
OpenSuSE Member<br>
Skype -- terrorpup<br>
twitter -- terrorpup<br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
</blockquote></div><br></div>