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脚本的内容.每一个合 ...
随机推荐
- 第3章文件I/O总结
1. open和create函数在fcntl.h中,close.lseek.read.write函数在unistd.h中 open函数通过进程有效用户ID判断读文件的权限 可以调用access函数判断 ...
- 使用SqlBulkCopy批量插入多条数据进入表中
由于工作中项目需求结算一次生成一批相同批次号的数据插入一个表中,然后再通过另一页面展示出来,所以需要用到一次性插入一批数据,所以就采用了SqlBulkCopy插入一批数据 1 public stati ...
- 利用iptables来配置linux禁止所有端口登陆和开放指定端口
from:http://www.myhack58.com/Article/sort099/sort0102/2011/31781.htm 1.关闭所有的 INPUT FORWARD OUTPUT 只对 ...
- [C#]递归遍历文件夹
/// <summary> /// 递归获取文件夹目录下文件 /// </summary> /// <param name="pathName"> ...
- REST接口规范
参考文章 这篇文章使用不同的method代表不同操作 http://www.cnblogs.com/tommyli/p/3913018.html 实际应用中(我们过去的应用) 则是直接使用url来代表 ...
- hadoop2——新MapReduces——yarm详解
YARN总体上仍然是Master/Slave结构,在整个资源管理框架中,ResourceManager为Master,NodeManager为Slave,ResourceManager负责对各个Nod ...
- 64位AutoItLibrary的安装
安装AutoItLibrary,除了要先已经安装好Robotframework之外,先要安装一个叫pywin32的工具 第一步:pywin32的安装 pywin32的下载地址: http://sour ...
- Mvvm Light Toolkit for WPF/Silverlight系列之搭建mvvmlight开发框架
Mvvm Light Toolkit for WPF/Silverlight系列之搭建mvvmlight开发框架 本章节,我将通过示例介绍如何搭建mvvmlight开发环境.示例中的我会针对wpf ...
- 安装app到Simulator
1.安装brew 打开命令行,执行以下命令: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install ...
- Android 自定义RadioButton实现
由于使用小米系统MIUI运行是RadioButton样式跟google Android API自定义的不一样,则我们可以定义任何想要的东东.没有做不到,只有想不到 Android 自定义RadioBu ...