ฉันเป็นผู้ใช้ใหม่ในยูนิกซ์ที่พยายามทำสคริปต์อย่างง่ายใน bash ที่จะทำการแตกไฟล์หลายไฟล์ในตำแหน่งที่ฉันแสดง ฉันคิดไม่ออกว่าทำไมมันถึงพัง ฉันกำลังแทรกสคริปต์ด้านล่าง ฉันหวังว่าจะย้ายไฟล์. tar.7z ที่บีบอัดไปไว้ในไดเรกทอรีอื่นในภายหลัง (ด้วยเหตุนี้ฉันจึงสร้างไดเรกทอรีใหม่ในสคริปต์ด้านล่าง) แต่ฉันแค่พยายามทำให้ส่วนหลักทำงานก่อน
#!~/bash
# My program to try to unzip several files with ending of tar.7z
# I have inserted the ability to enter the directory where you want this to be done
echo "What file location is required for unzipping?"
read dirloc
cd $dirloc
mkdir oldzippedfiles
for directory in $dirloc
do
if
[ $directory=*.tar.7z ]
then
cat $directory | 7za x -an -txz -si -so | tar -xf -
fi
done
echo "unzipping of file is complete"
exit 0
cat
? คุณสามารถให้ตัวอย่างของไดเรกทอรีที่คุณต้องการเรียกใช้สคริปต์นี้ได้หรือไม่?