set

Official Description

Sets shell options.

Syntax

set [+ | -abCefhkmnopstuvx] [+ | -o option ...] [+ | -A name] [argument ...]

Options

-A name prepares a variable for array assignment.

-f disables filename generation.

-h causes each command to become a tracked alias when it's first encountered.

-o provides lots of options, including emacs, vi, noclobber, xtrace, verbose, ignoreeof, and so on.

-v prints shell input lines as they are read.

-x prints commands and their arguments as they are executed.

Oddities

Other arguments are positional parameters and are assigned, in order, to $1, $2, and so on.

Example

 $ set den cheryl # Set up positional parameters using set $ $ print $1 $2 den cheryl $ $ print $- # Show currently set options (interactive, ...

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.