File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ name : Append value(s) to an array
3+ command : " {{array_name}}+=({{values}})"
4+ tags :
5+ - shell
6+ description : Loops through an array, running a command on each value.
7+ arguments :
8+ - name : array_name
9+ description : The name of the array to append values
10+ default_value : ~
11+ - name : values
12+ description : The values to append to the array, space-separated
13+ default_value : ~
14+ source_url : " https://opensource.com/article/18/5/you-dont-know-bash-intro-bash-arrays"
15+ author : Wyatt-Stanke
16+ author_url : " https://github.com/Wyatt-Stanke"
17+ shells :
18+ - Zsh
19+ - Bash
Original file line number Diff line number Diff line change 1+ ---
2+ name : Make a new, empty array
3+ command : " {{array_name}}=()"
4+ tags :
5+ - shell
6+ description : Makes an empty array and assigns it to variable "array_name"
7+ arguments :
8+ - name : array_name
9+ description : The name of the array to create
10+ default_value : ~
11+ source_url : " https://opensource.com/article/18/5/you-dont-know-bash-intro-bash-arrays"
12+ author : Wyatt-Stanke
13+ author_url : " https://github.com/Wyatt-Stanke"
14+ shells :
15+ - Zsh
16+ - Bash
Original file line number Diff line number Diff line change 1+ ---
2+ name : Get number of elements in an array
3+ command : " echo ${#{{array_name}}[@]}"
4+ tags :
5+ - shell
6+ description : Gets the number of elements in an array, and prints it to stdout.
7+ arguments :
8+ - name : array_name
9+ description : The name of the array to get the size of
10+ default_value : ~
11+ source_url : " https://opensource.com/article/18/5/you-dont-know-bash-intro-bash-arrays"
12+ author : Wyatt-Stanke
13+ author_url : " https://github.com/Wyatt-Stanke"
14+ shells :
15+ - Zsh
16+ - Bash
Original file line number Diff line number Diff line change 1+ ---
2+ name : Get a value from an array
3+ command : " echo ${{{array_name}}[{{index}}]}"
4+ tags :
5+ - shell
6+ description : Gets a value from an array and prints it to stdout.
7+ arguments :
8+ - name : array_name
9+ description : The name of the array to get a value from
10+ default_value : ~
11+ - name : index
12+ description : The index of the value to get (starting at 0)
13+ default_value : ~
14+ source_url : " https://opensource.com/article/18/5/you-dont-know-bash-intro-bash-arrays"
15+ author : Wyatt-Stanke
16+ author_url : " https://github.com/Wyatt-Stanke"
17+ shells :
18+ - Zsh
19+ - Bash
Original file line number Diff line number Diff line change 1+ ---
2+ name : Loop through an array and run a command on each value
3+ command : " for i in ${{{array_name}}[@]}; do {{command}}; done"
4+ tags :
5+ - shell
6+ description : Loops through an array, running a command on each value.
7+ arguments :
8+ - name : array_name
9+ description : The name of the array to loop through
10+ default_value : ~
11+ - name : command
12+ description : The command to run on each value in the array
13+ default_value : ~
14+ source_url : " https://opensource.com/article/18/5/you-dont-know-bash-intro-bash-arrays"
15+ author : Wyatt-Stanke
16+ author_url : " https://github.com/Wyatt-Stanke"
17+ shells :
18+ - Zsh
19+ - Bash
Original file line number Diff line number Diff line change 1+ ---
2+ name : Set an index in an array to a value
3+ command : " {{array_name}}[{{index}}]={{value}}"
4+ tags :
5+ - shell
6+ description : Makes an empty array and assigns it to variable "array_name"
7+ arguments :
8+ - name : array_name
9+ description : The name of the array to set the value
10+ default_value : ~
11+ - name : array_index
12+ description : The index of the array to set
13+ default_value : ~
14+ - name : value
15+ description : The value to set the array index to
16+ default_value : ~
17+ source_url : " https://opensource.com/article/18/5/you-dont-know-bash-intro-bash-arrays"
18+ author : Wyatt-Stanke
19+ author_url : " https://github.com/Wyatt-Stanke"
20+ shells :
21+ - Zsh
22+ - Bash
You can’t perform that action at this time.
0 commit comments