shell function/for in/for (())/string concat/has dir/rename using regex/if(())/exit/execute command and pass value to variable/execute python
#!/bin/bash #remove the MER.*_ in file name for all the files in a dir
function getdir(){
for element in `ls $1`
do
dir_or_file=$1"/"$element
if [ -d $dir_or_file ]
then
getdir $dir_or_file
else
#deal with each file in dir
mv $dir_or_file `echo $dir_or_file|sed 's/MER.*)_//g'`
fi
done
} #check the input args
if (($#<1));then
echo "please input the dir of calibration images"
exit
fi root_dir=$1
getdir $root_dir #create the dir name using timestr
result_dir="./result_of_"$(date +%Y:%m:%d-%H:%M) echo $result_dir #if the dir doesn't exists, create
if [ ! -d $result_dir ];then
mkdir $result_dir
fi # execute python program
python zss_calibrateFrom_whole_dir.py $root_dir $result_dir ##########################
#for i in 4 7
#for((i=0;i<10;i++));
#do
#echo $i
#for file in `ls ./cali-8-14-18/"$i"/*.png`
#do
#mv $file `echo $file|sed 's/MER.*)_//g'`
#done;
#done;
注意:shell脚本中的空格
参考:
比较字符串
https://www.jb51.net/article/56559.htm
if then elif then else fi用法
https://blog.csdn.net/m0_37138008/article/details/72814543
shell function/for in/for (())/string concat/has dir/rename using regex/if(())/exit/execute command and pass value to variable/execute python的更多相关文章
- string.Join和string.Concat的区别
源自Difference between String.Join() vs String.Concat() With .NET 4.0, String.Join() uses StringBuilde ...
- 声明:function FileSetAttr ( const FileName : string
对文件和文件夹都有效 FileSetAttr('D:\Administrator\Desktop\patcher\Win32\Release\config\element\update',faHid ...
- 关于String.concat()方法和StringBuffer.append()方法的学习:方法是如何追加字符到源字符串的
问题分析: 首先,看看两段代码的运行结果,两段代码分别是: 第一段代码,关于String.concat()方法的测试: public static void main(String[] args) { ...
- String+ String.Concat String.Format StringBuilder 之间的性能测试
找到一篇国外的代码,专门来测试这个, String+ String.Concat String.Format StringBuilder 前三个在100个左右字符串差不多, String.Concat ...
- StringBuilder String string.Concat 字符串拼接速度再议
首先看测试代码: public class StringSpeedTest { "; public string StringAdd(int count) { string str = st ...
- StringBuilder String string.Concat 字符串拼接速度
首先看测试代码: public class StringSpeedTest { "; public string StringAdd(int count) { string str = st ...
- java String、String.concat和StringBuilder性能对比
看到网上有人已经做过对比,并且贴出了代码,然后我运行了之后发现跟我分析的结论差距很大.发现他的代码有个问题,UUID.randomUUID() 首次调用耗时会很高,这个耗时被计算给了String,这对 ...
- C# 字符串拼接性能探索 c#中+、string.Concat、string.Format、StringBuilder.Append四种方式进行字符串拼接时的性能
本文通过ANTS Memory Profiler工具探索c#中+.string.Concat.string.Format.StringBuilder.Append四种方式进行字符串拼接时的性能. 本文 ...
- Unable to execute command or shell on remote system: Failed to Execute process
1.问题描述 先说下我的项目环境:jenkins部署在windows下面,项目部署也是在windows下面,ssh服务器是FreeSSHd,原来是打算用Send files or execute co ...
随机推荐
- atitit. web组件化原理与设计
atitit. web组件化原理与设计 1. Web Components提供了一种组件化的推荐方式,具体来说,就是:1 2. 组件化的本质目的并不一定是要为了可复用,而是提升可维护性. 不具有复用 ...
- MVC & Entity Framework(1)- 开发环境
一直都有接触asp.net mvc,希望自己借此次机会把Blog搭起来的同时能够更深入地学习相关知识. ①新建 打开VS2012,新建ASP.Net MVC 4项目,接着选择“空”模板(因为不想用自带 ...
- JDBC连接数据库的四种方式:DriverManager,DataSource,DBCP,C3P0
方法1:使用java.sql.DriverManager类 驱动管理器类,用于管理所有注册的驱动程序. (注:DataSource 接口是 JDBC 2.0 API 中的新增内容,它提供了连接到数据源 ...
- pow函数
pow函数如果直接强制类型转换成int,会导致精度的损失.如果是int的幂计算,建议重写函数.或者用double型进行计算.
- 机器学习算法( 七、AdaBoost元算法)
一.概述 当做重要决定时,大家可能都会考虑吸取多个专家而不只是一个人的意见.机器学习处理问题时又何尝不是如此?这就是元算法(meta-algorithm)背后的思路.元算法是对其他算法进行组合的一种方 ...
- TCP/IP笔记(八)应用层协议
TCP/IP的应用层涵盖了OSI参考模型中第5.第6.第7层的所有功能,不仅包含了管理通信连接的会话层功能.转换数据格式的标识层功能,还包括与对端主机交互的应用层功能在内的所有功能. 利用网络的应用程 ...
- Link-based Classification相关数据集
Link-based Classification相关数据集 Datasets Document Classification Datasets: CiteSeer: The CiteSeer dat ...
- Python_ip代理
#encoding=utf8import urllibimport urllib2import sys sys.path.append('D:/python/beautifulsoup')sys.pa ...
- 客户端-服务器端互动比较与原生实例(比较ajax,server-sent event,websocket/netsocket)
昨日学习了websocket的原生实例,觉得有必要把几种常见的客户端-服务器端无刷新交互形式列举比较: 一.Ajax:客户端决定何时主动向Server端发请求 如:无刷新评论.无刷新更换图片. 主要目 ...
- (转)fock函数详解
转自:http://www.cnblogs.com/bastard/archive/2012/08/31/2664896.html linux中fork()函数详解 一.fork入门知识 一个进程, ...