英文:
How to print unix tool version in BusyBox container?
问题
我无法弄清楚如何在BusyBox容器中打印(unix工具)的版本:
```bash
$ docker run -it quay.io/quay/busybox:latest
$ awk --version
awk: 未识别的选项 `--version'
BusyBox v1.32.0 (2020-08-31 17:40:13 UTC) 多功能调用二进制文件。
用法:awk [选项] [AWK_PROGRAM] [文件]...
-v VAR=VAL 设置变量
-F SEP 使用SEP作为字段分隔符
-f FILE 从FILE中读取程序
-e AWK_PROGRAM
$ cut --version
cut: 未识别的选项 `--version'
BusyBox v1.32.0 (2020-08-31 17:40:13 UTC) 多功能调用二进制文件。
从每个输入文件中打印所选字段到stdout
-b LIST 仅从LIST中输出字节
-c LIST 仅从LIST中输出字符
-d CHAR 使用CHAR而不是制表符作为字段分隔符
-s 仅输出包含分隔符的行
-f N 仅打印这些字段
-n 忽略
有什么建议吗?许多mulled容器都是基于BusyBox构建的,最好了解一下。
谢谢
<details>
<summary>英文:</summary>
I can't figure out how to print (unix tool) versions within a BusyBox container:
```bash
$ docker run -it quay.io/quay/busybox:latest
$ awk --version
awk: unrecognized option `--version'
BusyBox v1.32.0 (2020-08-31 17:40:13 UTC) multi-call binary.
Usage: awk [OPTIONS] [AWK_PROGRAM] [FILE]...
-v VAR=VAL Set variable
-F SEP Use SEP as field separator
-f FILE Read program from FILE
-e AWK_PROGRAM
$ cut --version
cut: unrecognized option `--version'
BusyBox v1.32.0 (2020-08-31 17:40:13 UTC) multi-call binary.
Usage: cut [OPTIONS] [FILE]...
Print selected fields from each input FILE to stdout
-b LIST Output only bytes from LIST
-c LIST Output only characters from LIST
-d CHAR Use CHAR instead of tab as the field delimiter
-s Output only the lines containing delimiter
-f N Print only these fields
-n Ignored
Any suggestions? Many mulled containers are built on top of BusyBox, best I get on top of this.
Thanks
答案1
得分: 1
busybox
是一个单一的程序,根据调用它的名称,充当各种工具之一。正如您在问题中所见,它显示其版本为 BusyBox v1.32.0
。
检查哪些工具是指向 busybox
的符号链接。所有这些工具都是相同的程序,因此具有相同的版本,所以您可能只需要 busybox
的版本和与之链接的命令列表。
根据 https://unix.stackexchange.com/q/15895/330217,显示 busybox
版本的最佳方法是
busybox | head -1
英文:
busybox
is a single program which acts as one of various tools depending on what name was used to call it. As you can see in the question, it shows its version as BusyBox v1.32.0
.
Check which tools are (symbolic) links to busybox
. All these are the same program and therefore have the same version, so you might only need the version of busybox
and a list of commands linked to it.
According to https://unix.stackexchange.com/q/15895/330217 the best way to display the version of busybox
is
busybox | head -1
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论