Busybox 中是否缺少花括号支持?
Is curly braces support missing in Busybox?
我在我的设备上使用 Busybox。当我尝试执行多目录删除时,Busybox 中包含的 "rm" 命令似乎忽略了我的大括号。有什么办法可以增加对它的支持吗?它破坏了一些包含带花括号的脚本的包,我不想在我自己的脚本中放置循环。
示例:
rm -rf /some/path/{foo,bar}
这取决于您使用的shell。 Busybox 至少有 2 个
默认 shells:ash
和 hush
并且,取决于您构建它的方式
可能两者都可用。如果rm -rf /some/path/{foo,bar}
对您不起作用,您可能正在使用 ash
。您可以查看:
$ echo [=10=]
ash
检查你是否有 hush
:
$ busybox hush
花括号应该在 hush
:
中工作
$ mkdir /tmp/curly-test
$ cd /tmp/curly-test
$ touch foo bar
$ cd /tmp
$ ls curly-test/{foo,bar}
curly-test/bar curly-test/foo
另请注意,作为最后的手段,您可以简单地替换 /bin/sh
bash
.
我在我的设备上使用 Busybox。当我尝试执行多目录删除时,Busybox 中包含的 "rm" 命令似乎忽略了我的大括号。有什么办法可以增加对它的支持吗?它破坏了一些包含带花括号的脚本的包,我不想在我自己的脚本中放置循环。
示例:
rm -rf /some/path/{foo,bar}
这取决于您使用的shell。 Busybox 至少有 2 个
默认 shells:ash
和 hush
并且,取决于您构建它的方式
可能两者都可用。如果rm -rf /some/path/{foo,bar}
对您不起作用,您可能正在使用 ash
。您可以查看:
$ echo [=10=]
ash
检查你是否有 hush
:
$ busybox hush
花括号应该在 hush
:
$ mkdir /tmp/curly-test
$ cd /tmp/curly-test
$ touch foo bar
$ cd /tmp
$ ls curly-test/{foo,bar}
curly-test/bar curly-test/foo
另请注意,作为最后的手段,您可以简单地替换 /bin/sh
bash
.