shell if elif fi

bash if elif else


# A=
# if [[ -z "$A" ]]; then
> echo zero
> elif [[ "ok" = "$A" ]]; then
> echo ok
> else
> echo else
> fi
zero

# A="ok"
if [[ -z "$A" ]]; then echo zero; elif [[ "ok" = "$A" ]]; then echo ok; else echo else; fi
ok
# A="ng"
if [[ -z "$A" ]]; then echo zero; elif [[ "ok" = "$A" ]]; then echo ok; else echo else; fi
else

コメント

人気の投稿