标题:请问下面一段命令文本输出问题答案对吗?
只看楼主
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-404038-1-1.html




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

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