我正在尝试准备一个与 gnu 并行使用的 bash 脚本。该脚本应采用文件名,将文件名的前缀存储为描述器,并将行数 (wc -l) 存储为数字变量。如果这些都成为在 perl 脚本中使用的变量。描述器工作正常。
但是我对行数的存储,或者我对 ${mm} 的使用没有生成 perl 脚本识别的数字变量。任何更正表示赞赏。
#!/bin/bash
# Get the filename and strip suffix
sample=$1
describer=$(echo ${sample} | sed 's/.sync//')
echo ${describer} # works fine
# Get the number of rows
mm=$(cat ${sample} | wc -l)
echo ${mm} # works fine but is this a numeric variable?
# run the script using the variables;
# the ${mm} is where the perl script says its not numeric
perl script.pl --input ${describer}.sync --output ${describer}.genepop --region ${describer}:1-${mm}