Linux in a Nutshell, Third Edition
by Ellen Siever, Stephen Spainhour, Jessica P. Hekman, Stephen Figgins
Name
set
Synopsis
set variable = value
set [option] variable[n]= value
set
Description
Set variable to value, or if multiple values are specified, set the variable to the list of words in the value list. If an index n is specified, set the nth word in the variable to value. (The variable must already contain at least that number of words.) With no arguments, display the names and values of all set variables. See also “Predefined Shell Variables” earlier in this chapter.
Option
- -r
tcsh only. List only read-only variables, or set specified variable to read-only.
Examples
%set list=(yes no maybe)Assign a wordlist %set list[3]=maybeAssign an item in existing wordlist %set quote="Make my day"Assign a variable %set x=5 y=10 history=100Assign several variables %set blankAssign a null value to blank
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access