From c808b7ed898d2682bf8c41ebf196ab2fcdf87c1f Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Tue, 20 Apr 2021 08:46:07 +0000 Subject: [PATCH] post(gnu-busybox): minor correction on zip support --- source/_posts/gnu-vs-busybox-tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_posts/gnu-vs-busybox-tools.md b/source/_posts/gnu-vs-busybox-tools.md index e247c95..81ca821 100644 --- a/source/_posts/gnu-vs-busybox-tools.md +++ b/source/_posts/gnu-vs-busybox-tools.md @@ -47,7 +47,7 @@ So, Alpine uses BusyBox and Ubuntu uses GNU. Ubuntu does include BusyBox by defa I tested the tools on Alpine and Ubuntu, and noted their behaviour. BusyBox = BB. -- **gzip/gunzip/zcat**: BB only support gzip/bzip2/xz format, not the ubiquitous zip. GNU can only extract the first file. Use unzip or bsdtar to extract all files. +- **gzip/gunzip/zcat**: BB only support gzip/bzip2/xz format, use BB's unzip for zip file. GNU can only extract the first file in a zip. - **unzip**: GNU doesn't support stdin as input. funzip can decompress from stdin, but only the first file (like zcat). BB support stdin and extract all files, through `unzip -`. - **sed**: BB doesn't support -z argument which is used to find/replace \n new line character. A [workaround](https://stackoverflow.com/a/1252191) is `sed ':a;N;$!ba;s/\n//g' file` or `sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g' file`. GNU `sed -z 's/\n//g' ` works. - **bsdtar**: Since GNU can only extract the first file, in addition to BB's unzip, another alternative is bsdtar. bsdtar is available through `libarchive-tools` package. To extract zip from stdin, use `$ bsdtar -xf -`.