#!/bin/bash#Remove the mer.*_ in file name is all of the files in a dirfunctionGetdir () { forElementinch' ls $` DoDir_or_file= $"/"$element if[-D$dir _or_file] then Getdir$dir _or_file Else #deal with all file in DirMv$dir _or_file' Echo$dir _or_file|sed ' s/mer.*) _//G ' fi done}#Check the input argsif(($#<1)); ThenEcho"Please input the dir of calibration images"Exitfiroot_dir= $Getdir$root _dir#Create the dir name using TimestrResult_dir="./result_of_"$ (Date +%y:%m:%d-%h:%M) echo$result _dir#if the dir doesn ' t exists, createif[!-D$result _dir];thenmkdir$result _dirfi#Execute Python programPython 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 Function/for In/for (())/string Concat/has dir/rename using regex/if (())/exit/execute command and pass value to Vari Able/execute python