mtv="$1"
echo "The program is \"`basename $0`\"."
if [ -d $mtv ]
then
read
fmtv()
{
until [ -e "$1" ] #测试"$1"的文件是否存在
do
a=`find $mtv -name $1`
if [ -f $a ]
then
cp $a $HOME/lmtv
fi
echo "$a复制完成!"
cat $1
shift #参数左移
done
}
else
echo "路径名称错误!"
- remove the line mtv="$1", it overwrite what you've just read
- define the function at the top of the script, instead of in the middle the script
- keep in mind that find might return many files!
Most importantly.
try it out on command line before put everything in a big script -- go step by step. :-)