ncutil 3

User's Guide

Running as a Shell

All of the listings presented in this manual illustrate ncutil running in pseudo-shell mode, where the user may type many commands at a prompt. This is the most efficient way to make use of the program, since each time it is executed it must initially build the directory tree structure. Pseudo-shell mode is invoked simply by invoking ncutil without an explicit command on the command line. In pseudo-shell mode, option flags may be passed to the program with each command typed by placing the flags between the command name and the arguments to that command.
  Listing 19: Pseudo-shell mode.
 [user@localhost ~]$ ncutil -activate [0 ]$ read -rw computer-name = My PowerBook -rw current-location = Office [0 ]$ setprop -P ::: current-location :::At\ Home [0 ]$ read -rw computer-name = My PowerBook -rw current-location = At Home
There are several commands that are only really useful when the program is run in pseudo-shell mode.

CommandExplanation
chdir {options} {directory} Makes the specified directory (referenced either by ID or path) the current directory for the program. The more UNIX-like "cd" form may be used, too.
pwd {options} Prints the canonical path form of the current directory.
commit {options} {directory} The properties associated with a directory are not pushed into the actual SystemConfiguration preference store until the program exits or this command is used.
refresh {options} {directory} Pulls a pristine copy of the directory's properties from the SystemConfiguration preference store, wiping-out any changes that have been made to it.
apply-changes {options} Forces all changes to be committed and then attempts to get the configd daemon to notice those changes and reconfigure the network state immediately.
set-options {options} A dummy command that does nothing but allows the user to provide command options. Useful if while in pseudo-shell mode the path separator needs to be set, for example.

The order of options, command, and arguments is modified slightly when ncutil is run from the command line itself:
  Listing 20: Using ncutil from the command line.
 [user@localhost ~]$ ncutil -activate -P : setprop 0 current-location :At\ Home [user@localhost ~]$ ncutil read 0 -rw computer-name = My PowerBook -rw current-location = At Home
Options should be specified first, then the ncutil command, followed by arguments to that command.
Previous Chapter Table of Contents  
Copyright © 2005 | Jeffrey T. Frey