variable issue in a bash in a shell script

Hi,

I am trying to write a PBS shell script that launches a bash process. The issue is that the bash process needs a variable in it and the shell script is interpreting the variable. How do I pass this as a literal string? Here is my code snippit:

TMP=".fasta"
FILEOUT=$FILE$TMP
cd ${PBS_O_WORKDIR}
bash "cat $FILE | perl -e '$i=0;while(<>){if(/^\@/&&$i==0){s/^\@/\>/;print;}elsif($i==1){print;$i=-3}$i++;}' > $FILEOUT"

The part that is giving the issues is the $i in the bash line. That is being interpreted and passed as a null string. I tried using /$i which gives the same result. My shell output looks like this:

bash: cat s_1_1.fastq | perl -e '=0;while(<>){if(/^\@/&&==0){s/^\@/\>/;print;}
elsif(==1){print;=-3}++;}' > s_1_1.fastq.fasta: No such file or directory

I am guessing there is another error in this because of the no such file part, but when I type

cat s_1_1.fastq | perl -e '$i=0;while(<>){if(/^\@/&&$i==0){s/^\@/\>/;print;}elsif($i==1){print;$i=-3}
$i++;}' > s_1_1.fastq.fasta

at the command prompt, it works.

Not familiar with PBS, but you usually use \ to escape things in double quotes, not /.

You also get a useless use of cat award.

DOH, its been a long day.

Thanks for the award. :o