Variables
Korn shell variable names can begin with an alphabetic (a–Z) or underscore character, followed by one or more alphanumeric (a–Z, 0–9) or underscore characters. Other variable names that contain only digits (0–9) or special characters (!, @, #, %, *, ?, $) are reserved for special parameters set directly by the Korn shell.
To assign a value to a variable, you can simply name the variable and set it to a value. For example, to assign abc to variable X:
$ X=abc
The typeset command can also be used to assign values, but unless you are setting attributes, it's a lot more work for nothing. If a value is not given, the variable is set to null. Here, X is reassigned the null value:
$ X=
This is not the same as being undefined. As we'll ...
Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The 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.