SHELL 你应该知道的语法

#!/bin/sh
#set -x
echo -n "can you write device drivers? "
read answer 
answer=`echo $answer | tr [a-z] [A-Z]`
if [ $answer = Y]
then 
 echo "Wow, you must be very skilled"
else 
 echo "neither can i "
fi


 

cat temp3.properties | while read LINE
do 
    row4index=`echo "$LINE" |  awk -F "=" '{print $1}'`
    index4index=`echo "$LINE" |  awk -F "=" '{print $2}'`
    cat temp5.properties | while read LINE4TYPE
    do
        row4dcc=`echo "$LINE4TYPE" |  awk -F "=" '{print $1}'`
        type4dcc=`echo "$LINE4TYPE" |  awk -F "=" '{print $2}'`
        cat temp7.properties | while read LINE4POSTPAIDFLAG
        do
            row4flag=`echo "$LINE4POSTPAIDFLAG" |  awk -F "=" '{print $1}'`
            type4flag=`echo "$LINE4POSTPAIDFLAG" |  awk -F "=" '{print $2}'`
            if [ $row4index -eq $row4dcc ] && [ $row4index -eq $row4flag ]
            then
                  echo "${index4index}|${type4dcc}|${type4flag}">>tempresult.properties
            fi
        done
    done
done


 

if [ -f $HOME/bus_gv_install/bin/common_ins.rc ]; then           
    . $HOME/bus_gv_install/bin/common_ins.rc                     
else                                                             
    echo "The file 'common_ins.rc' does not exist,program abort."
    exit 1                                                       
fi 


 

if [ ! -d $HOME/batchTrade ]; then
   mkdir $HOME/batchTrade
   chmod 777 $HOME/batchTrade
fi


 

#£¡/bin/echo Warning£ºthis library should be sourced!
#ostype():
ostype() 
{
osname=`uname -s`
OSTYPE=UNKNOWN
case &osname in
  "FreeBSD") OSTYPE="FREEBSD"
  ;;
  "SunOS")¡¡OSTYPE="SOLARIS"
  ;;
  "Linux") OSTYPE="LINUX"
  ;;
  esac
  return 0
  }


 

evenodd()
{
   LAST_DIGIT=`echo $1 | sed `s/\(.*\)\(.\)$/\2/``
   case $LAST_DIGIT in
   0|2|4|6|8 )
     return 1
     ;;
     *)
     return 0
     ;;
     esac
}


 

isalive()
{
  NODE=$1
  $PING¡¡-c 3 $NODE > /dev/null 2>&1
  if [ $? -eq 0 ]
  then 
    return 1
  else
    return 0
  fi 
 }


 

#!/bin/sh
sqlfile=$1
cat $sqlfile | while read LINE
do  
   tmp=`echo "$LINE" |awk -F "-+=" '{print toupper($1)}'`
	 echo $tmp
done


 

#!/bin/sh
epoch_days=719591
second='date +'%s''
minute='date + '%M''
hour='date +'$k''
day='date +'%d''
month='date + '%m' | sed 's/0*//''
yaer='date + '%Y''


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值