16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

tcsh: complete<br />

This completion completes commands (words in position 0, p/0) which begin<br />

with co (thus matching co*) to compress (the only word in the list). The leading<br />

- indicates that this completion is to be used only with ambiguous commands.<br />

3. This is an example of n-type completion. Any word following find and<br />

immediately following -user is completed from the list of users.<br />

> complete find ’n/-user/u/’<br />

4. This demonstrates c-type completion. Any word following cc and beginning<br />

with -I is completed as a directory. -I is not taken as part of the directory<br />

because we used lowercase c.<br />

> complete cc ’c/-I/d/’<br />

5. Different lists are useful with different commands:<br />

> complete alias ’p/1/a/’<br />

> complete man ’p/*/c/’<br />

> complete set ’p/1/s/’<br />

> complete true ’p/1/x:Truth has no options./’<br />

These complete words following alias with aliases, man with commands, and<br />

set with shell variables. true doesn’t have any options, so x does nothing<br />

when completion is attempted and prints ’Truth has no options.’ when<br />

completion choices are listed.<br />

The man example, and several other examples below, could just as well have<br />

used c/* or n/* as p/*.<br />

6. Words can be completed from a variable evaluated at completion time,<br />

> complete ftp ’p/1/$hostnames/’<br />

> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu)<br />

> ftp [^D]<br />

rtfm.mit.edu tesla.ee.cornell.edu<br />

> ftp [^C]<br />

> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net)<br />

> ftp [^D]<br />

rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net<br />

or from a command run at completion time:<br />

> complete kill ’p/*/’ps | awk \{print\ \$1\}’/’<br />

> kill -9 [^D]<br />

23113 23377 23380 23406 23429 23529 23530 PID<br />

The complete command does not itself quote its arguments, so the braces,<br />

space and $ in {print $1} must be quoted explicitly.<br />

7. One command can have multiple completions:<br />

> complete dbx ’p/2/(core)/’ ’p/*/c/’<br />

This example completes the second argument to dbx with the word core and<br />

all other arguments with commands. The positional completion is specified<br />

before the next-word completion. Since completions are evaluated from left to<br />

right, if the next-word completion were specified first it would always match<br />

and the positional completion would never be executed. This is a common<br />

mistake when defining a completion.<br />

8. The select pattern is useful when a command takes only files with particular<br />

forms as arguments. For example,<br />

> complete cc ’p/*/f:*.[cao]/’<br />

678 z/<strong>OS</strong> <strong>V1R9.0</strong> <strong>UNIX</strong> <strong>System</strong> <strong>Services</strong> <strong>Command</strong> Reference<br />

completes cc arguments only to files ending in .c, .a, or .o. select can also<br />

exclude files, using negation of a glob-pattern as described under “Filename<br />

substitution” on page 643.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!