前言
bash if condition
範例
這邊以外部傳入參數 $1,作為我們 If 要判斷的內容
#!/bin/bash
if [[ $1 == "123" ]]; then
echo "hello"
elif [[ $1 == "456" ]]; then
echo "world"
else
echo "not found"
fi
結果
reference
- https://linuxhint.com/bash_if_else_examples/
- 比較一個括弧跟兩個括弧的差別 (Single and Double Brackets)