リスト内のすべてのファイルの各サブディレクトリにテキストファイルを作成する必要があります。
例えば、subdirectory1
は、すべてのファイルのリストを.txt
とし、subdirectory2
にはsubdirectory2
のすべてのファイルのリストが.txt
として含まれます。 私は試しました各サブディレクトリ内のすべてのファイルの.txtを作成
#!/bin/bash
for X in "$directory" *
do
if [ -d "$X" ];
then
cd "$X"
files="$(ls)"
echo "$files" >> filesNames.txt
fi
done
しかし、これは何も生成されませんでした。私は絶対にそれがパイプラインスクリプトの一部になるので、シェルスクリプトとして必要ですが、私はそれを動作させるように見えることはできません。
ここに、私にそのようなファイルやディレクトリのコメントを与えない調節されたスクリプトがあります。私は、フォルダが存在し、このコマンドの前に実行されるコマンドでそれを使用したことを知っています。
#!/bin/bash
#Retrieve the base directory path
baseDir=$(dirname "$ini")
#Retrieve the reference genome path
ref=$(dirname "$genome")
#Create required directory structure
tested="$baseDir/tested"
MarkDups1="$baseDir/MarkDups1"
#don't create if already exists
[[ -d "tested" ]] || mkdir "$tested"
[[ -d "MarkDups1" ]] || mkdir "$MarkDups1"
#create a text file with all sorted and indexed bam files paths
#!/bin/bash
for x in $MarkDups1/*/;
do
(cd "$x"; ls > filesNames.txt)
done
'[[-d" $ tested "]]'と '[[-d" $ MarkDups1 "]]';現在、2つの変数に格納されている名前ではなく、2つのリテラルディレクトリ名をテストしています。 – chepner