Linux Shell Script

Asked 1 years ago, Updated 1 years ago, 96 views

Linux is trying to create a sh file and use it like a command.

The function is to tar all the folders in the directory where I am currently located, including sub-files and folders.You need to compress into three functions: gz, tar, and zip.

I don't know how to squeeze this ㅠ<

[command] [Folder name to compress] I want to use it like this.

linux shell-script

2022-09-21 18:49

1 Answers

I think this is enough.

#!/bin/bash
tar cvf $1.tar $1
tar cvzf $1.tar.gz $1
zip -r $1.zip $1


2022-09-21 18:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.