1

I have a small if statement which checks if my filenames are correct. At first i only needed 2 names to compare within the if statement.

if [ $name == $name3 ]; then
    qsub calculatecorrelation.sh $i $j
fi

Now i want to compare 3 names and if all correct continue the script. My first attempt looks like this but i am not convinced this is the way to do it.

if [ $name == $name3 == $name5 ]; then
    qsub calculatecorrelation.sh $i $j $k
fi

So how can i check all 3 names to be the same and than continue.

4

2 回答 2

2

我认为你应该能够做到这一点:

if [ $name == $name3 ] && [ $name3 == $name5 ];
于 2013-04-25T10:27:54.297 回答
2

我认为您只是在寻找逻辑 AND运算符 &&

if [ $name == $name3 ] && [ $name3 == $name5 ]; then
于 2013-04-25T10:28:14.223 回答