Created
September 30, 2014 06:03
-
-
Save pn11/4e2051ca322448d39505 to your computer and use it in GitHub Desktop.
haddしてから足しあわせた数をファイル名に追加するだけのスクリプト。while read 以下のloopの中でexprを使ってnadd+1をやろうとしたのになぜかできなかった。しかたないのでリダイレクトしてごにょごにょ。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#hadd_and_rename.sh target.root sources.root | |
if [ $# -lt 2 ] | |
then | |
echo "Number of argument is wrong. Exit hadd_and_rename.sh..." | |
exit | |
fi | |
#declare -i nadd | |
#nadd=0 | |
#nadd=`expr $nadd + 1` | |
touch $1.tmp | |
hadd $@ | while read f | |
do | |
echo $f | |
source=`echo $f | grep "hadd Source file"` | |
if [ "$source" ] | |
then | |
echo "test" >> $1.tmp | |
fi | |
done | |
nadd=`cat $1.tmp | wc -l` | |
rm $1.tmp | |
echo "nadd = $nadd" | |
addname=`echo $1 | sed s/.root/-$nadd.root/g` | |
mv $1 $addname | |
echo "$addname created." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment