Badly placed ()'s

Edit - I don't know how to delete posts. The question I asked here ended up not being the question I should have asked as I didn't realise I needed to edit my script to comply with SGE.

Hi,

My script is:

#!/bin/bash

# Perform fastqc on files in a specified directory.

for ((j=1; j <=17; j++))
dofiles=/data4/user/batch"$j"/*.fastq.gzfor i in $files;dofastqc -f fastq -o /data4/user/test/fastqc/ $idonedone

The command I'm running is:

qsub -o fastqc.log ~/bin/fastqc.sh

The error I'm getting is:

Badly placed ()'s

I don't understand what's happening.

Thanks!
Una

try in script:

for j in $(seq 1 17)
1 Like

Hi,

Thanks for the suggestion. This gave the error

Illegal variable name

I'm actually having loads of bother with qsub. Made a test script sleep.sh

#!/bin/sh

for i in {1..60} ; do
       echo $i
       sleep 1
done

But when I do

qsub -o sleep.log sleep.sh 

the output file gives the errors:

for: Command not found.
do: Command not found.
i: Undefined variable.

Any ideas what's happening?

maybe:

for j in `seq 1 17`
1 Like

Returns

for: Command not found.
do: Command not found.
j: Undefined variable.

Does the directive file have to have a pbs extension? i.e. sleep.pbs

It looks like you run your script by tcsh.
Is /bin/bash really a bash?

ls -l /bin/bash
/bin/bash --version

--
I see you run it with qsub. Don't know what qsub is but maybe you should force a bash with

qsub -o fastqc.log /bin/bash ~/bin/fastqc.sh

No - I was working with .sh. Edit: I'm working with SGE not PBS.

---------- Post updated at 04:30 AM ---------- Previous update was at 04:25 AM ----------

I believe so:

ls -l /bin/bash
-rwxr-xr-x 1 root root 768952 Sep 26  2014 /bin/bash

/bin/bash --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
qsub -o fastqc.log /bin/bash ~/bin/fastqc.sh
Unable to run job: Script length does not match declared length.
Exiting.

Hi.

Just a guess, change from:

fastqc -f fastq -o /data4/user/test/fastqc/ $i

to (by adding quotes):

fastqc -f fastq -o /data4/user/test/fastqc/ "$i"

Good luck ... cheers, drl