Creating a list
One way to create a list is to simply use the list
command. Bear it in mind that with this command you must be aware of quotations. Inconsistent quotations can have unexpected results on the list elements. The syntax is as follows:
list value1 value2…
How to do it…
In the following example, we will create a list containing single characters. Return values from the commands are provided for clarity. Enter the following command:
% list John Mary Bill John Mary Bill
How it works…
The list
commands returns a list containing all the arguments supplied, or an empty string if no arguments are specified. Backslashes and braces are added to the string representation of the list as it is necessary to provide a properly formatted list that will work with any list
command.
There's more…
As mentioned earlier, quotation marks can alter how items are stored in our list. In the following example, we will recreate our list; but this time the elements will be encased in quotation marks to illustrate...