简单的shell脚本运行抱错,请帮忙看下

wyfwx 2011-12-08 05:31:15
#!/bin/sh
#this is test
if["1" > "0"]
then
echo "out 1"
fi



./test123运行提示 if[1:command not found
...全文
123 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wyfwx 2011-12-09
  • 打赏
  • 举报
回复
thank every body!
rucypli 2011-12-08
  • 打赏
  • 举报
回复
if[ "1" > "0" ]
then
echo "out 1"
fi

向良玉 2011-12-08
  • 打赏
  • 举报
回复
if语句里 [ "1" > "0" ] 两边都需要空格的
reactiveF 2011-12-08
  • 打赏
  • 举报
回复
#!/bin/sh
#this is test
if [ "1" > "0" ] #加空格
then
echo "out 1"
fi

# chmod +x test.sh
# ./test.sh
out 1
wyfwx 2011-12-08
  • 打赏
  • 举报
回复
加空格后 [1:command not found
Arnold9009 2011-12-08
  • 打赏
  • 举报
回复
[前后要加空格
在linuxshell里,空格很重要
daviddb7 2011-12-08
  • 打赏
  • 举报
回复
加空格

19,610

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧