当我尝试运行我的作业时出现错误。
#!/bin/bash
## Assignment 2
echo Please enter a User Name:
read u
if [ $u!="root"]; then
echo Searching for Username!
grep $u /etc/passwd|sed 's/$u/hidden/gi'
elif [ $u!="toor"]; then
echo Root is NOT allowed.
else
echo Toor is definetely NOT allowed.
fi
输出:
Please enter a User Name:
user1
./assign2.sh: line 6: [bthiessen: command not found
./assign2.sh: line 9: [bthiessen: command not found
Toor is definetely NOT allowed.
我的 if 语句有什么问题?