#!/bin/bash
strvar="hello"
#定义一个字符串变量
if [${strvar} = "he"] 是否与he相等
then
echo correct
else
echo wrong
fi
运行的时候出现了这个错误是怎么回事啊?
[he: command not found
[问题]新手提问简单的问题
-
- 帖子: 12
- 注册时间: 2007-01-08 19:55
- 5451vs5451
- 帖子: 345
- 注册时间: 2006-07-14 18:56
- 来自: Apple Valley, Planet Tux, Linux System
Re: [问题]新手提问简单的问题
方括号前后都要空格。kaixinlaohe 写了:#!/bin/bash
strvar="hello"
#定义一个字符串变量
if [${strvar} = "he"] 是否与he相等
then
echo correct
else
echo wrong
fi
运行的时候出现了这个错误是怎么回事啊?
[he: command not found
-
- 帖子: 12
- 注册时间: 2007-01-08 19:55