in reply to Re: Running a Perl Code within a Perl Code Using "Shell Module"
in thread Running a Perl Code within a Perl Code Using "Shell Module"

Given this directory structure
~/MyPerl | |__ ans # this stores all the .fasta files (input) |__ result_ans # to store the result |__ mycode.pl
Does this script does what it should:
find ans/ -name '*.fasta' -maxdepth 1 -print0 \ | xargs -r -0 -P5 -n1 sh -c 'perl mycode.pl "$1" > ~/MyPerl/result_ans +/"$1".out' ''
Cause it gives this message:
: /home/myname/MyPerl/result_ans/ans/hm14_ans.fasta.out: No such file +or directory

Regards,
Edward

Replies are listed 'Best First'.
Re^3: Running a Perl Code within a Perl Code Using "Shell Module"
by Aristotle (Chancellor) on Nov 10, 2005 at 04:06 UTC

    No, that can’t work. As you can see in the error message, the path component is included in the logfile’s path. Just execute this from within ~/MyPerl/ans and omit the path argument to find, that’s the easiest solution.

    Makeshifts last the longest.