| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1855 人关注过本帖
标题:请问下面一段命令文本输出问题答案对吗?
只看楼主 加入收藏
winglesswu
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2013-1-28
结帖率:71.88%
收藏
 问题点数:0 回复次数:0 
请问下面一段命令文本输出问题答案对吗?
cat shapes

#!/bin/bash
for shapes in square triangle circle
do
  if [ "$2" != $shape ]
    then echo "\$2 is not a $shape"
  fi
done

if [ "$1" = "$2" ]
   then echo "Message 1"
     exit 1
fi

if [ $# != 2 ]
  then echo "Message 2"
   exit 2
fi

Q1: shapes square square
$2 is not a triangle
$2 is not a circle
Message 1

Q2: echo $1
1
Q3: shapes circle triangle
$2 is not a triangle //我认为这边的答案应该是$2 is not a square 不知道对不对
$2 is not a circle
搜索更多相关主题的帖子: cat triangle 
2013-04-12 22:45
快速回复:请问下面一段命令文本输出问题答案对吗?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014017 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved