gpt4 book ai didi

linux - .tar.Z : no such file or directory When I try to JAR a file . 。为什么?

转载 作者:太空宇宙 更新时间:2023-11-04 09:06:34 24 4
gpt4 key购买 nike

在我的代码中,我创建了 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

回声“++++++++++++++++++++++++++++”

最佳答案

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

关于linux - .tar.Z : no such file or directory When I try to JAR a file . 。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9891683/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com