function usage conclude

来源:互联网 发布:阿里云免费云服务器 编辑:程序博客网 时间:2024/05/16 19:21

shell

function exitfile {

#transfer parameter (attention : it is not in function name ,like exitfile(a); it didn't permit have "()" in shell function. sometimes it is in awk/nawk/xwak function which is in shell)


a=$1

 if [ -f $a ]
 then
  #OFC33L40.0
  load=$(echo $a |nawk 'if (/OFC(\d+)/) exit $1')
  echo "line21 $load"
  release=$(echo $a |nawk 'if (/OFC\d+L(\d+)/) exit $1')
  echo "line23 $release"
  cp /apx/ecpc/$a/1apx10/omp/OMPgiu/OMPsugr/com/atcalink /var/tmp/atcalink
  exit 10
 else
  exit 11
 fi
}

 http://bbs.chinaunix.net/thread-1820454-1-1.html

tcl:

proc chkDBMS { AP mode } {{-------------------------------------parameter
 global C env

 # If this isn't an NGN, nothing to check.
 if { "$C(AP${AP}platform)" != "NGN" } {
  return 0]------------------------------------------------return value
 }

 }

 

perl

sub part (Code $is_sheep, *@data) {
my (@sheep,@goats);
for@data {
if $is_sheep($_) { push @sheep, $_ }
else { push@goats, $_ }
}
return (\@sheep, \@goats);
}

原创粉丝点击