Re: perl script vs bash
Re: perl script vs bash
- Subject: Re: perl script vs bash
- From: Emilie Kim <email@hidden>
- Date: Fri, 25 Aug 2006 17:16:07 -0700
Hi,
Make sure your input is being passed in as arguments in the shell
script action, and try putting quotes around the file names being
passed to tar:
So instead of:
!system "tar czf $file.tgz $file" or die "erreur à l'éxecution de la
commande tar -czf: $!\n";
try
!system "tar czf \"$file.tgz\" \"$file\"" or die "erreur à l'éxecution
de la commande tar -czf: $!\n";
Hope it helps!
emilie
On 25 Aug 2006, at 12:01, email@hidden wrote:
Hi!
I got an issue with a Perl script under Automator. First, in order to
add a process to Finder, i tried to make it by using perl, but it
didn't work. I didn't understand, so I went on Internet to find a
similar script or an answer to my issue, and i found this:
#!/bin/bash
for f in "$@"
do
path=`dirname "$f"`
file=`basename "$f"`
cd "$path"
tar czf "$file.tgz" "$file"
done
and mine is:
#!/usr/bin/perl -w
use File::Basename;
foreach (@ARGV){
$file=basename $_;
$dir=dirname $_;
chdir $dir or die "erreur, impossible de changer de répertoire: $!";
!system "tar czf $file.tgz $file" or die "erreur à l'éxecution de la
commande tar -czf: $!\n";
}
Whereas the first script works well on Automator, the second doesn't.
I did this workflow:
get selected files > execute a script perl
thanks of your attention,
Syl20
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden