bash shell script 내에서 if 조건문에 복수의 조건문을 할때, 

if [ condition1 || confition2 ] 혹은 if [condition1 && condition2] 와 같이 시도를 해본다.

잘못된거고 정확히는

if [[ condition1  || condition2 ]] 혹은 if [[ condition1  &&  condition2 ]] 

이다.

중요한것은 condition의 시작과 끝에 space 를 잊지 말라는 것.


아래 예제가 있다.


출처 :  http://www.unix.com/shell-programming-scripting/51832-using-if-statement.html


잘못된 예)


data1="hello"
data2="world"
if [ "$data2" != "world" && "$data1" != "hello"]
then
{
echo "good afternnon"
}
else
{
echo " good morning"
}
fi



올바른 예)


Don't forget to let a space before ] and after [ 

data1="hello" data2="world" if [[ "$data2" != "world" && "$data1" != "hello" ]] then { echo "good afternnon" } else { echo " good morning" } fi




WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,