“shell -eq” Kode Jawaban

-eq skrip shell

a=30
b=20
if [[ $a -eq $b ]]; then
    echo "Match"
else
    echo "No Match"
fi

Output:No Match
=================================================
a=John
b=George
if [[ $a -eq $b ]]; then
    echo "Match"
else
    echo "No Match"
fi

Output:Match
which is wrong

Conclusion:
-eq is for numerical comparison and == is for string comparison
rachelgreen

shell -eq

-eq is for numerical comparison and == is for string comparison
a=30
b=20
if [[ $a -eq $b ]]; then
    echo "Match"
else
    echo "No Match"
fi

Output:No Match
=================================================
a=John
b=George
if [[ $a -eq $b ]]; then
    echo "Match"
else
    echo "No Match"
fi

Output:Match
which is wrong
rachelgreen

Jawaban yang mirip dengan “shell -eq”

Pertanyaan yang mirip dengan “shell -eq”

Lebih banyak jawaban terkait untuk “shell -eq” di Shell/Bash

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya