Use tar in Linux Shell

Source: Internet
Author: User

We encountered the following problems during package packaging using Linux shell scripts:

Tar: removing leading '/' from Member names

Shell Content

#! /Bin/sh

Pkg_dir =$ {PWD}/release

Pkg_name1_release.tar.gz

Tar-zvcf $ {pkg_name }$ {pkg_dir}

If you execute this scripts in the upper-level directory of the release, the following error occurs: Tar: removing leading '/' from Member names

Take a closer look,No better solution found. Google on the Internet basically uses tar.-PParameter, but the absolute path is introduced in [unknown end user] during decompression. Therefore, the problem cannot be solved.

Use the followingWorkaround

Because the tar operation is performed in the upper-level directory of release, you can directly Delete $ {PWD} In pkg_dir =$ {PWD}/release and use pkg_dir = release.

[P.s] if you have any experts to solve this problem, please kindly advise!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.