sg 的 -c 选项有什么作用?

sg 的 -c 选项有什么作用?

sg 的 -c 选项有什么作用?至少在我的机器上,手册页无法解释此选项。

答案1

它没有记录在手册页中,但查看源代码,它看起来像是通过“/bin/sh -c”运行命令,而不是直接执行它。我认为它主要是为了与其他 Unix 系统上的 sg 命令兼容。

答案2

概要

   sg [-] [group [-c ] command]

描述

    The sg command works similar to newgrp but accepts a command.
    The command will be executed with the /bin/sh shell.

正如你所看到的,sg 在 -c 开关之后接受一个命令(我们可以通过查看概要得知),该命令将使用 /bin/sh shell 执行。

相关内容