Shell脚本文件意外结束

Shell脚本文件意外结束,shell,Shell,这是如何工作的? 对不起,我是初学者,找不到任何教程或网站来解释这件事。 当你知道如何找到这个请告诉我,我真的很感激 #!/bin/bash cd Blur clear echo "Rangcheck" if grep -w $name ./rangs/exo_users.txt; then echo "Blur" > "./status/rang.txt" ./menu.sh else if grep -w $name ./rangs/police_users.

这是如何工作的? 对不起,我是初学者,找不到任何教程或网站来解释这件事。 当你知道如何找到这个请告诉我,我真的很感激

#!/bin/bash
cd Blur
clear


echo "Rangcheck" 

if grep -w $name ./rangs/exo_users.txt; 
then
    echo "Blur" > "./status/rang.txt"
    ./menu.sh
else
if grep -w $name ./rangs/police_users.txt; 
then
    echo "Police" > "./status/rang.txt"
    ./menu.sh
else
if grep -w $name ./rangs/bank_users.txt; 
then
    echo "Bank" > "./status/rang.txt"
    ./menu.sh
else
if grep -w $name ./rangs/fly_users.txt; 
then
    echo "Fly" > "./status/rang.txt"
    ./menu.sh
else
if grep -w $name ./rangs/userlist.txt; 
then
    echo "User" > "./status/rang.txt"
    ./menu.sh

不要使用
else
if
,使用
elif
,并确保使用
fi
终止
if
表达式:

#!/bin/bash
cd Blur
clear


echo "Rangcheck" 

if grep -w "$name" ./rangs/exo_users.txt; 
then
    echo "Blur" > "./status/rang.txt"
    ./menu.sh
elif grep -w "$name" ./rangs/police_users.txt; 
then
    echo "Police" > "./status/rang.txt"
    ./menu.sh
elif grep -w "$name" ./rangs/bank_users.txt; 
then
    echo "Bank" > "./status/rang.txt"
    ./menu.sh
fi
还可以尝试粘贴脚本,以便自动指出此类问题