#!/bin/bash -x
# 一部のファイルを保存しておくスクリプト(サンプル)

escapepattn()
{
set +x
local pattn=${1}
pattn="`echo "${pattn}"|sed -e 's/ /\\\ /'g`"
pattn="`echo "${pattn}"|sed -e 's/(/\\\(/'g`"
pattn="`echo "${pattn}"|sed -e 's/)/\\\)/'g`"
pattn="`echo "${pattn}"|sed -e 's/\[/\\\[/'g`"
pattn="`echo "${pattn}"|sed -e 's/\]/\\\]/'g`"
escapedmatchpattn=${pattn}
set -x
}

DOCUMENTROOT=/home/disklessfun/Documents
escapedmatchpattn=

################ TBS kirakira ###################
cd "${DOCUMENTROOT}/TBS/kirakira" || exit 1
mkdir -p keep

escapepattn "*ikushima*.mp3"
eval cp -np '${escapedmatchpattn}' keep

escapepattn "*yoshida*.mp3"
eval cp -np '${escapedmatchpattn}' keep

escapepattn "*machiyama*.mp3"
eval cp -np '${escapedmatchpattn}' keep


################ TBS dig ###################
cd "${DOCUMENTROOT}/TBS/dig" || exit 1
mkdir -p keep

escapepattn "*choice*.mp3"
eval cp -np '${escapedmatchpattn}' keep


echo "Done"
