Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What does the -c option of sg do? At least on my machine, the man page fails to explain this option.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

It's not documented in the man page, but looking at the source code it looks like it runs the command via "/bin/sh -c" instead of executing it directly. I think it is there mostly for compatibility with the sg command on other Unix systems.

share|improve this answer
add comment

SYNOPSIS

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

DESCRIPTION

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

As you can see, sg accepts a command after the -c switch ( we can tell that by looking at the synopsis ) which will be executed using /bin/sh shell.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.