条件が1つの裏地の場合[重複]

条件が1つの裏地の場合[重複]

この状況でシングルライナーを入手するにはどうすればよいですか?

if [ -f ~/.ssh/config ]
then
    echo -e "\xE2\x9C\x94 Config file existing"
fi

私の試み:

if [ ! -f ~/.ssh/config ] || echo -e "\xE2\x9C\x94 Config file existing"

ベストアンサー1

この試み、

if [ -f ~/.ssh/config ]; then echo -e "\xE2\x9C\x94 Config file existing"; fi

または

[ ! -f ~/.ssh/config ] || echo -e "\xE2\x9C\x94 Config file existing"

または

[ -f ~/.ssh/config ] && echo -e "\xE2\x9C\x94 Config file existing"

else最後に配置する必要があります

[ -f ~/.ssh/config ] && echo -e "\xE2\x9C\x94 Config file existing" || echo -e "\xE2\x9E\x97 No config file"

おすすめ記事