title: What is a list in Bash?
body: <p>I have searched for a similar question here, but surprisingly could not find any.</p>
  
  <p>In GNU bash, there is (a construct? a structure? a data type?) called "<a href="https://www.gnu.org/software/bash/manual/bash.html#Arrays" rel="noreferrer">arrays</a>". Arrays are well documented in the bash documentation, so I think that I understand the basics.</p>
  
  <p>But suddenly, in the documentation there also comes up the term "list". For example, it is used when talking about <a href="https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html#Filename-Expansion" rel="noreferrer">filename expansion</a> (emphasis is mine):</p>
  
  <blockquote>
    <p>If one of these characters appears, then the word is regarded as a pattern, and replaced with an alphabetically sorted <strong>list</strong> of filenames matching the pattern (see Pattern Matching).</p>
  </blockquote>
  
  <p><strong>Therefore, I have three questions:</strong></p>
  
  <ol>
  <li>What does "list" mean here?</li>
  <li>Is it used in the same meaning as in <a href="https://www.gnu.org/software/bash/manual/html_node/Looping-Constructs.html#Looping-Constructs" rel="noreferrer">for loop description</a>?</li>
  <li>I am somehow lost in a whitespace world in bash. If this "list" is a separate concept to arrays (as I think), is it treated specially when it comes to whitespaces and <code>IFS</code>, or in the same way as an array?</li>
  </ol>
  
  <p>There is <a href="https://www.gnu.org/software/bash/manual/bash.html#Lists" rel="noreferrer">another use of the "list" term</a> when talking about sequence of one or more pipelines, but I am aware that it most probably means a different kind of lists.</p>
  
  <hr>
  
  <h3>UPDATE</h3>
  
  <ol start="4">
  <li>Since I see that the way that this "list structure" works is very similar to how arrays work – what are the differences between them?</li>
  </ol>
  
  <h3>UPDATE 2</h3>
  
  <ol start="5">
  <li><p>What are the uses cases when "lists" are preferred over arrays? For example, let us compare. Let us create two files:</p>
  
  <p>$ touch file1.txt file2.txt</p></li>
  </ol>
  
  <p>When it comes to lists, I can do the following:</p>
  
  <pre><code>$ A=*.txt ; echo $A
  file1.txt file2.txt
  $ 
  </code></pre>
  
  <p>And when it comes to arrays, I can do the following:</p>
  
  <pre><code>$ B=(*.txt) ; echo ${B[@]}
  file1.txt file2.txt
  $ 
  </code></pre>
  
  <p>While these two results are exactly the same, are there any cases when arrays and lists return different results?</p>
  
  <hr>
  
  <h3>UPDATE 3</h3>
  
  <p>I might have confuse something, because in the above example it seems to be a list "wrapped" in an array. I do not know whether it makes a difference.</p>