这个shell脚本代码有什么作用?

时间:2017-10-14 04:40:21

标签: shell

帮助!我试图确定以下shell脚本的作用:

#!/bin/sh
echo "Enter file name: \c"
read FILE

if [ $FILE = "example.txt" ]
then i=1

while [ $i -le 15 ]
do
    cp example.txt example$i.txt
    i=`expr $i + 1`
done

else 
   echo "ERROR"
fi

你能帮忙吗?

2 个答案:

答案 0 :(得分:1)

这个程序显然是:

  1. 提示用户输入文件名
  2. 如果文件名等于example.txt,则制作15个副本,如example1.txtexample2.txt等。
  3. 否则,它会返回错误。

答案 1 :(得分:0)

用户输入文件名 程序检查它是否等于example.txt 如果是,那么它会创建15份副本 如果否,则显示ERROR

相关问题