bash shell
脚本语法怪异,其他语言循环写入数组或列表都很简单实现,或有相应函数来做。
以下用两种方法来实现:
c=0
for i in `ls ./Data_Analysis/Quantitation/*-VS-*.xls`;do
pre=`echo $i |sed 's/.*\///'`
filelist[$c]="$pre"
((c++))
done
echo $c
for i in ${filelist[@]}
do
sample=`echo $i | sed 's/.xls//'`
echo $sample
done
filelist=()
for i in `ls ./Data_Analysis/Quantitation/*-VS-*.xls`;do
cp $i ./protein
sample=`echo $i |sed 's#.*/##' |sed 's/.xls//'`
filelist+=("$sample")
done
echo ${filelist[@]}
for i in ${filelist[@]};do
echo $i
done
手机扫一扫
移动阅读更方便
你可能感兴趣的文章