Texas Instruments matrix-gui-2.0 hacking -- execute_command.sh

本文涉及的产品
云数据库 Tair(兼容Redis),内存型 2GB
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
简介: #!/bin/sh #Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ # # # Redistribution and use in source and binary forms, w...
#!/bin/sh

#Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ 
#
# 
# Redistribution and use in source and binary forms, with or without 
# modification, are permitted provided that the following conditions 
# are met:
#
# Redistributions of source code must retain the above copyright 
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the 
# documentation and/or other materials provided with the   
# distribution.
#
# Neither the name of Texas Instruments Incorporated nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

mkdir -p tmp                # 创建tmp目录
mkdir -p lock               # 创建lock目录

i=0

for item in "$@"            # 迭代传入的参数
do

  if [ $i -eq 0 ]
  then
      
    filename=$item          # 获取文件名
  fi
 
  if [ $i -eq 1 ] 
  then
        
    outputfilename=$item    # 获取输出文件名
  fi

  if [ $i -gt 1 ]
  then
    touch "lock/"$item      # 创建lock文件,这个好象是暗个随机生成的数字字符串

   fi
 i=`expr $i + 1`            # i++

done

echo "Filename:"$filename
echo "Output:"$outputfilename
# 1. 执行程序,程序会卡在这里?以下是run_script.php运行程序:
#   $script_link = $found_app["Exec"];
#   # strval(): 用于获取变量对应的字符串值
#   # rand(): 返回随机整数
#   $random_string = strval(rand());
#   $random_string .= strval(rand());
#   # addslashes(): 在指定的预定义字符前添加反斜杠
#   $script_command = "./execute_command.sh \"".addslashes($script_link). "\" ".$random_string.".txt ".$lock_list;
#   # 获取系统执行结果最后一行
#   # system()第二个参数:如果提供的return_var参数,则外部命令执行后的
#   # 返回状态将会被设置到此变量中
#   $last_line = system($script_command." > /dev/null 2>/dev/null & ", $retval);
# 2. 对于Qt应用程序,个人觉得这里还是堵塞 
eval $filename > "tmp/"$outputfilename 2>&1

#Using a more unique string to detect if the script is completed
# 这行文字重定向到tmp下的输出文件尾
echo "_?!!MATRIX_SCRIPT_COMPLETED!!?_" >> "tmp/"$outputfilename

# 清一下屏,没找到这条命令
refresh_screen &

i=0
for item in "$@"
do

  if [ $i -gt 1 ]
  then
    rm -f "lock/"$item          # 删除lock下的文件

   fi
 i=`expr $i + 1`                # i++

done

sleep 20
rm "tmp/"$outputfilename        # 删除tmp下的文件

 

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
IsoAlgo --- Connect Symbols
IsoAlgo --- Connect Symbols eryar@163.com Key Words: IsoAlgo   确定好符号的方向后,就可以把管路中各个符号按其拓朴关系连接起来,使之与三维模型中的拓朴关系一致。
1056 1
|
Oracle 关系型数据库 MySQL
|
Oracle 关系型数据库 MySQL
|
Ubuntu 开发工具 C语言
Building QT projects from the command line
/************************************************************************ * Building QT projects from the command line * 说明: * 很多时候都是通过Qtcreator进行项目的创建以及编译,但是有时候可能 * 会遇到一些编译小问题,这时候命令行创建工程、编译工程可以作为测试、验证 * 的一种手段。
863 0
|
XML 前端开发 Shell
I.MX6 Manufacturing Tool V2 (MFGTool2) Update Command List (UCL) User Guide translate
  Manufacturing Tool V2 (MFGTool2)    Update Command List (UCL) User Guide                       Contents(目录)         Contents(目录)             ...
1105 0
|
前端开发 JavaScript PHP
Texas Instruments matrix-gui-2.0 hacking -- index.php
Matrix Application Launcher var has_graphics = true; var link_history = ["submenu.
1053 0