首页 > 解决方案 > 我的 bash 脚本有什么问题,为什么它不起作用?

问题描述

#! bin/bash
echo "Hello what is your first name."
   read name
if [ $name ]; then
   echo "$name, that's a funny name"
else
   echo "I asked for your name, you better answer me, i'll give you another chance, this time you better answer me, you understand, YES or NO"
read response 
   if [ $response ]; then
echo "Then tell me WHAT IS YOUR NAME"
   read name
echo "Finally, thank you, bye $name"
   else 
echo "Say goodbye to your family"
   fi

标签: bashbin

解决方案


问题似乎在你的第一线

改变

#! bin/bash

#!/bin/bash

推荐阅读