嗨,我是一个bash编程的新手,需要一些帮助。我正在建立一个图像处理管道。我想能够在一个文件夹中将png图像传递给clusterImage.pl,然后将输出的文件传递给seperateObjects.pl,输出的文件具有相同的名称,但具有kmeansOutput。 all.matrix附加到最后。以下是我到目前为止,但它不起作用。 任何帮助将不胜感激。谢谢如何使用Bash获取一个文件夹中的.png文件数组
#!/bin/bash
#This script will take in an image and a matrix file.
#The output will be an image and a matrix file.
list=`ls *.png`
for i in $list
do
$file="./$list"
$image_array = $list
echo $file
#Cheching to see if the file exists.
for((j=0;j<=i;j++))
do
if [ -e image_array[j] ]; then
echo $file
echo "Begining processing"
#Take in an image and create a matrix from it.
perl clusterImage.pl SampleImage.png
#Take in a matrix and draw a picture showing the centers of all
#of the colonies.
perl seperateObjects.pl SampleImage.png.kmeansOutput.all.matrix
echo "Ending processing"
else
echo "There is an issue"
fi
done
done
尝试使用'-x'选项来[调试你的bash脚本](http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html)。 – jschmier 2010-06-22 18:11:18
“不工作”不提供任何信息。请发布错误消息或预期行为的特定偏差。 – 2010-06-22 18:47:46