Bash * and @ Relative to Array Elements: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:
=Overview=
=Overview=


<code>*</code> and <code>@</code> are bash syntax elements that tokenize arrays. They are used to process command line argument (<code>$*</code>, <code>$@</code> and <code>"$@"</code>), [[Bash_Arrays#Reference_All_Indexed_Array_Elements|values for indexed arrays]], keys and values for associative arrays, etc.
<code>*</code> and <code>@</code> are bash syntax elements that tokenize arrays. They are used to process command line argument (<code>$*</code>, <code>$@</code> and <code>"$@"</code>), [[Bash_Arrays#Reference_All_Indexed_Array_Elements|values for indexed arrays]], [[Bash_Arrays#Get_All_Associative_Array_Keys|keys]] and [[Bash_Arrays#Get_All_Associative_Array_Values|values]] for associative arrays, etc.
 
The difference between these two syntax elements becomes apparent when the array elements contain spaces.
 
=<tt>...*</tt>=
 
=<tt>...@</tt>=
 
=<tt>"...@"</tt>=

Revision as of 18:42, 1 April 2024

Internal

Overview

* and @ are bash syntax elements that tokenize arrays. They are used to process command line argument ($*, $@ and "$@"), values for indexed arrays, keys and values for associative arrays, etc.

The difference between these two syntax elements becomes apparent when the array elements contain spaces.

...*

...@

"...@"