在BASH中找不到命令

时间:2016-12-15 22:41:02

标签: bash

我得到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

使用以下脚本

#!/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

已安装所有程序。我错过了什么?

提前谢谢。

MIC

1 个答案:

答案 0 :(得分:4)

您设置PATH environment variable,这是bash用于查找程序的内容。由于PATH不再包含包含parallelfindsed的目录,因此bash无法找到它们。

您应该将您使用的变量名称从PATH更改为path之类的其他名称。您还应该使用带引号的变量的使用,如下所示:

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