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 執行。

相關內容