0

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}
4

1 に答える 1