嗨,我是一個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