Linux shell if
#!/bin/bash
NAME="hehe";
read -p "Entry your name: " yourname;
if [ ${NAME} = ${yourname} ]; then
echo "same!";
else
echo "difference!";
fi;
这是一个简单的Linux Shell脚本示例,它读取用户输入的名字并与预设的名称hehe进行比较。如果两者相同,脚本会输出same! 否则输出difference!。这个脚本展示了基本的Shell条件判断和用户交互功能。
Linux shell if
#!/bin/bash
NAME="hehe";
read -p "Entry your name: " yourname;
if [ ${NAME} = ${yourname} ]; then
echo "same!";
else
echo "difference!";
fi;
1627

被折叠的 条评论
为什么被折叠?