.tar.Z:没有这样的文件或目录当我尝试JAR文件时..为什么?

时间:2012-03-27 14:34:55

标签: linux scripting solaris

在我的代码中,我创建了2个文件夹。一个是存储档案的文件夹,另一个是存档中的文件夹,它将有tar,压缩和Jar完成。

为什么当它到达jar命令时,它说.tar.Z没有这样的文件或目录??

 #!/bin/bash

 echo "++++++++++++++++++++++++++"
 #The script should prompt the user for the name of a folder to archive.
 echo "Please enter the name of a folder to archive"
 read file1


 echo "++++++++++++++++++++++++++"
 #The script should prompt the user for the name of a folder to store the archives in.
 echo "Please enter a foldername to store archives in"
 read file2


 echo "++++++++++++++++++++++++++"
 #The script should create the folder input in step 2.
 mkdir $file2
 cd $file2
 mkdir $file1
 echo "Created Files"

 echo "++++++++++++++++++++++++++"
 #The script should run the command to TAR all of the files in the folder specified in step 1 to a tar archive called [folder name].tar in the archive folder specified in step 2.
 tar cf $file1.tar $file1


 echo "++++++++++++++++++++++++++"
 #The script should compress the TAR file you created in step 4 to a [folder name].tar.Z in the archive folder specified in step 2.
 compress -v $file1.tar


 echo "++++++++++++++++++++++++++"
 #The script should run the command to JAR all of the files in the folder specified in      step 1 to a jar archive called [folder name].jar in the archive folder specified in step 2.
 jar cf $ffile1.jar $ffile1.tar.Z

echo" +++++++++++++++++++++++++++++++++++++++++

1 个答案:

答案 0 :(得分:3)

您写的是$ffile1.tar.Z而不是$file1.tar.Z