Shell implements compressing multiple files

Write a script in Linux environment

Let the user input several files from the keyboard, and the script can archive and compress the several files into one file:

1. First introduce the case statement format

case SWITCH in

value1)

  statement

  ...

  ;;

value2)

  statement

  ...

  ;;

*)

  statement

  ...

esac

2. The script is as follows:

DEST reads the name of the compressed file, and COMP reads the compression method

Add permissions to the file:

Create three files:

 

Execute the script:

Check that the compressed file has been generated:

 

So far, the script has realized the compression of three files.

`\ (^ ω ^) /`

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324861848&siteId=291194637