根据以下内容写一个SHELL Script

Write a shell script that
(1) ask for a file name from the user,
(2) check whether a file with the given file name exists in the current directory, and
(3) return the result to the user in a neat readable format.

#!/bin/ksh
while [ 1 ]
do
echo "Please enter a filename:\c"
read filename
if [ -z "${filename}" ];then
continue
elif [ -f "`pwd`/${filename}" ];then
more ${filename}
break
fi
done追问

大神,perl script会吗
Let there be a file, score.txt, which contains some integers. There is only one number per line, and the number of lines is unknown. Write a Perl script that
(1) read the intergers in score.txt,
(2) calculate the average,
(3) print the average on screen with proper format

追答

i don't know perl.
but your request can process with shell very well.

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网