A
A
Alexey Kostyukhin2021-01-20 15:16:57
linux
Alexey Kostyukhin, 2021-01-20 15:16:57

How to pack files or folders in bash script?

Task: It is necessary to create a data container from a bash script.
1. I have a data archive. For example, a folder with static js files packed in tar.gz (static.tar.gz)

2. I want to create a bash script that can firstly convert this archive into some data format (string), for example base64, and secondly push this stuff into some variable and then the script will describe the commands for its "parsing" to the home folder and so on.

As a result, we have a bash script that is independent and does not depend on the archive created earlier. When this script is called, it converts the "string" in base64 format or any other into the original archive, then it unpacks it into the same folder and works with the files of the unpacked archive.

Ideally, you should get a "mini-installer" when you run which we get an unpacked application or something else.

How do I push an archive into bash?

PS Attention! I'm not interested in how to create an archive from files using bash! I'm interested in how to convert the archive into a certain string and put it inside the script!

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2021-01-20
@aleksey4uk

base64 --help
MYFILE=$(base64 -w0 <file>)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question