user977828
user977828

Reputation: 7679

command not found in BASH

I am getting command not found:

> sh readsdb.sh `pwd`/test 2
/home/lorencm/test 2
readsdb.sh: line 8: parallel: command not found
readsdb.sh: line 8: find: command not found
hello
readsdb.sh: line 10: parallel: command not found
readsdb.sh: line 10: find: command not found
readsdb.sh: line 10: sed: command not found
readsdb.sh: line 11: parallel: command not found
readsdb.sh: line 11: find: command not found
readsdb.sh: line 12: find: command not found
readsdb.sh: line 12: parallel: command not found

> parallel -h
Usage:
parallel [options] [command [arguments]] < list_of_arguments

with the below script

#!/bin/bash
module load fastqc/0.11.2-java-1.7.0_60

PATH="$1"
CPUS="$2"

echo $PATH $CPUS
find $PATH/*.gz -type f | parallel -j $CPUS "fastqc {}"
echo "hello"
find $PATH/*_fastqc.zip -type f | sed 's/\.zip$//' | parallel -j $CPUS 'unzip -c {}.zip {}/fastqc_data.txt | crimson fastqc /dev/stdin {}.json'
find $PATH/*_fastqc.zip -type f| parallel -j $CPUS 'dir={}; dir=${dir%.zip}; dir=${dir##*/}; unzip -c {} "$dir/fastqc_data.txt" | crimson fastqc /dev/stdin > {.}.json'
find $PATH/ -type f | parallel -j $CPUS md5sum '>' {}.md5

All programs are installed. What did I miss?

Thank you in advance.

Mic

Upvotes: 0

Views: 2189

Answers (1)

Chai T. Rex
Chai T. Rex

Reputation: 3018

You set the PATH environment variable, which is what bash uses to find programs. Since PATH no longer includes the directories which contain parallel, find, and sed, they can't be found by bash.

You should change the variable name you use from PATH to something else like path. You should also surround uses of variables with quotes, like this:

find "$path/*.gz" -type f | parallel -j "$CPUS" "fastqc {}"

Upvotes: 4

Related Questions