再麻烦你一个问题,这一空填什么 final=
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/08/08 03:42:16
再麻烦你一个问题,这一空填什么 final=
cp( )
{
local final
if [ $# -eq 1 ] ; then ## Only one arg,
command cp -b "$1" .## so copy it to the current directory
else
final=
if [ -d "$final" ] ; then
command cp -b "$@" ## copy all the files into it
else
command cp -b "$@" .## otherwise,copy to the current directory
fi
fi
}
cp( )
{
local final
if [ $# -eq 1 ] ; then ## Only one arg,
command cp -b "$1" .## so copy it to the current directory
else
final=
if [ -d "$final" ] ; then
command cp -b "$@" ## copy all the files into it
else
command cp -b "$@" .## otherwise,copy to the current directory
fi
fi
}
![再麻烦你一个问题,这一空填什么 final=](/uploads/image/z/19916674-34-4.jpg?t=%E5%86%8D%E9%BA%BB%E7%83%A6%E4%BD%A0%E4%B8%80%E4%B8%AA%E9%97%AE%E9%A2%98%2C%E8%BF%99%E4%B8%80%E7%A9%BA%E5%A1%AB%E4%BB%80%E4%B9%88+final%3D)
final=`eval echo \\$$#`
将最后一个位置变量的值赋给它,如果最后一个位置变量为目录,则将前面所有的位置变量(文件)拷贝到最后的目录中.
再问: 这个答案可以么final=${!#} 。${!#}是什么意思?麻烦了~
再答: 可以,是一样的目的,它取最后一个位置参数的值,${!#}比`eval echo \\$$#` 更简洁一点。
将最后一个位置变量的值赋给它,如果最后一个位置变量为目录,则将前面所有的位置变量(文件)拷贝到最后的目录中.
再问: 这个答案可以么final=${!#} 。${!#}是什么意思?麻烦了~
再答: 可以,是一样的目的,它取最后一个位置参数的值,${!#}比`eval echo \\$$#` 更简洁一点。