您的位置:首页 > 运维架构 > Shell

shell中,依次向同一脚本中传递不同的参数

2012-09-18 00:25 393 查看
=====main.action======

#abc.sh

#!/bin/bash

echo -e "please in put the first number!"

read num1

if [ $num1 -eq 2 ];then

echo -e "please in put the second number!"

read num2

if [ $num2 == "abc" ];then

echo -e "the second number is : $num2"

else

echo -e "ERROR"

fi

else

echo -e "the first num is : $num1"

fi

=========================

=====a.txt========

2

abc

=================

运行方式:cat a.txt | sh abc.sh

哈哈 这个问题想了好久 .....郁闷死了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: