Code instance of compressing multiple files in Linux shell

Time:2021-1-28

Write a script in Linux

Let the user input several files from the keyboard. The script can archive and compress these files into one file

1. First, introduce the case statement format

2. The script is as follows:

Dest reads the name of the compressed file, while comp reads the compression mode

Add permissions to files:

Create three files:

Execute script:

View that the compressed file has been generated:

So far, the script implements the compression of three files.

The above is the whole content of this article, I hope to help you learn, and I hope you can support developer more.