2014年1月31日金曜日

bash file loop

Directory内にある指定fileを検索し、コマンドを実行するひな形。

#!/bin/bash

#set -x

if [ $# -ne 1 ]; then
        echo "usage : ${0} [part_of_directory_string]"
        exit 1
fi

filter="Log_20140131"

#for target_file in $( ls . | grep ${filter} ); do
for target_file in ./${filter}*
do
        clear

        echo "------------------- ${target_file}"
        diff ${target_file}/* | less -S

#       read www
done

set +x

0 件のコメント:

コメントを投稿