2

I'm writing a script to set a defaults preference for all users on a machine.

When I run it from a root shell, the defaults command runs as if it's been given incorrect arguments.

bash-3.2# su - mheath -c defaults read
Command line interface to a user's defaults.
Syntax:

'defaults' [-currentHost | -host <hostname>] 
followed by one of the following:

read                                 shows all 
...

I am assuming that using su is causing the arguments to end up in the wrong place and that defaults is hard coded to expect arguments in certain places. But I've no idea how to get around this.

1 Answer 1

4

You're correct about the su picking up the args incorrectly - you need to quote them together:

su - mheath -c "defaults read"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .