Shell编程之函数调用
Shell中的函数调用的使用方法见我下面的代码示例:
#!/bin/bash # value init ExP="adb shell /data/local/tmp/vpxdec --yv12 --flipuv -t 2 --md5 data/local/tmp/vp9Input/subset_function_test/Boating_1920x1080_t4_yv12_400frames_skip200.webm";
TT="adb shell ls -l /data/local/tmp/";
loop_count=;
targetMd5="2e8698fe47dd40bf6260206416530985"; # Compare two value and output result,$ is src,$ is target
function Compare()
{
#echo "Source value:$1, Target value:$2";
if [ "$1" = "$2" ]; then
echo "The same!";
return ;
else
echo "Different!"
return ;
fi } # LoopEx: excute a programm in a loop, $ is program,$ is loop count, $ is targetMd5
function LoopEx()
{
local Ex=$;
local loop_count=$;
local target=$;
echo -e "Programm is $Ex \nloop_count ==$loop_count, TargetMd5==$target"
for i in $(seq $loop_count); do
local output=$($Ex);
local outputMd5=${output::}
Compare $outputMd5 $target;
if [ "$?" != "" ]; then
echo "Loop Break index is [$i],result MD5:$outputMd5"
break
fi
done;
} # function main, shell excute from here
function Main()
{
echo "Imagation GPU Version test run ...";
LoopEx "$ExP" $loop_count $targetMd5
} Main;
后面写其他的简单脚本可以套用这个模板来做
Shell编程之函数调用的更多相关文章
- Linux Shell编程入门
从程序员的角度来看, Shell本身是一种用C语言编写的程序,从用户的角度来看,Shell是用户与Linux操作系统沟通的桥梁.用户既可以输入命令执行,又可以利用 Shell脚本编程,完成更加复杂的操 ...
- Linux下的Shell编程
从程序员的角度来看, Shell本身是一种用C语言编写的程序,从用户的角度来看,Shell是用户与Linux操作系统沟通的桥梁.用户既可以输入命令执行,又可以利用 Shell脚本编程,完成更加复杂的操 ...
- 转:Linux Shell编程入门
http://www.cnblogs.com/suyang/archive/2008/05/18/1201990.html 从程序员的角度来看, Shell本身是一种用C语言编写的程序,从用户的角度来 ...
- Linux Shell编程参考大全
本文记录Linux Shell编程中常用基本知识,方便快速入门以及查询使用. 本文主要分为以下几个部分: 一.Shell中的变量 任何编程语言中,有关变量的定义,作用范围,赋值等都是最最基础的知识. ...
- linux shell 编程参考
#!/bin/bash my_fun() { echo "$#" } echo 'the number of parameter in "$@" is '$(m ...
- 转inux Shell编程入门
http://www.cnblogs.com/suyang/archive/2008/05/18/1201990.html 从程序员的角度来看, Shell本身是一种用C语言编写的程序,从用户的角度来 ...
- Linux(五)shell编程基础
一.Linux shell简介 1.shell概述 Shell 是用户与内核进行交互操作的一种接口,目前最流行的 Shell 称为 bash Shell Shell 是一门编程语言& ...
- 2. Shell编程第二讲
(1) 条件测试: test [ 命令 test 或 [ 可以测试一个条件是否成立,如果测试结果为真,则该命令的Exit Status为0,如果测试结果为假,则命令的Exit Status为1(注 ...
- shell编程基础进阶
为什么学习shell编程 shell脚本语言是实现linux/unix 系统管理机自动化运维所必备的重要工具,linux/unix系统的底层及基础应用软件的核心大部分涉及shell脚本的内容.每一个合 ...
随机推荐
- javaIo流实际应用
/*查看目录下所有的文件*/ package cn.file; import java.io.File; public class Text2 { public static void main(St ...
- 对BFC的理解
转载http://www.cnblogs.com/lhb25/p/inside-block-formatting-ontext.html 在解释 BFC 是什么之前,需要先介绍 Box.Formatt ...
- asp.net中生成缩略图并添加版权实例代码
这篇文章介绍了asp.net中生成缩略图并添加版权实例代码,有需要的朋友可以参考一下 复制代码代码如下: //定义image类的对象 Drawing.Image image,newimage; //图 ...
- delphi发送html带附件邮件
var html: TIdText; begin if not SMTP.Connected then SMTP.Disconnect(); try SMTP.Connect; try if SMTP ...
- linux常用命令搜索
解压tar - xzvf webcmp.tar.gz /目的目录 压缩tar - czvf webcmp.tar.gz /压缩源文件 发包命令 cd /cap/sc_bossdata_20140516 ...
- 隐藏 Status Bar
iOS6和iOS7在隐藏 Status Bar 三种方式比较: Storyboard 界面上选中UIViewController,最右边Simulated Metrics找到 Status Bar 设 ...
- js 介绍
createjs 工作内容:html5游戏开发岗位要求:1. 熟悉HTML5特性, 掌握canvas开发技能;2.能独立的搭建出易扩展,高效,强壮,通用的前端底层框架;3.熟悉常用的JS开发框架或工具 ...
- vc6静态库的生成和调用
转自vc6静态库的生成和调用 1.静态库的生成: 在vc6.0++中Ctrl+N选择Projects下的Win32 Static Library,Project name:SumLib,点击OK,下一 ...
- SessionId
http://www.codeweblog.com/session-cookie-jsessionid-url-rewriting/
- 17.1.2 Replication Formats
17.1.2 Replication Formats 复制格式 17.1.2.1 Advantages and Disadvantages of Statement-Based and Row-Bas ...