我有以下卖出代码正确的输出
#!/bin/sh
echo "hello"
echo "enter the salutation $abc"
read -r abc
if [ "$abc" = "1" ]
then
echo "Hiiii"
elif [ "$abc" = "2" ]
then
echo "haaaaa"
fi
echo "enter name $xyz"
read -r xyz
if
if [ "$xyz" = "1" ]
then
echo "Chris"
elif [ "$xyz" = "2" ]
then
echo "Morris"
fi
echo "you had put salutation as" "$abc"
echo "you entered name as " "$xyz"
我需要的最终印刷要像
you had put salutation as Hii
you entered name as chris
什么,我得到的是
you had put salutation as 1
you entered name as 1
Any help? Do I need to mention the final statement inside the if elif statement?
那你当你进入提示f或'salutation'和'name'分别? –
@anthony我为 –
输入了1您的代码不完整。它会抛出语法错误:'test.sh:第24行:语法错误:文件意外结束。不会产生你说你看到的输出。 –