Merge pull request #1462 from kozhemyak/patch/add-bash-lastindex
Add a way to get the last element
This commit is contained in:
commit
214a4ed82e
1
bash.md
1
bash.md
|
@ -455,6 +455,7 @@ Fruits[2]="Orange"
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
echo ${Fruits[0]} # Element #0
|
echo ${Fruits[0]} # Element #0
|
||||||
|
echo ${Fruits[-1]} # Last element
|
||||||
echo ${Fruits[@]} # All elements, space-separated
|
echo ${Fruits[@]} # All elements, space-separated
|
||||||
echo ${#Fruits[@]} # Number of elements
|
echo ${#Fruits[@]} # Number of elements
|
||||||
echo ${#Fruits} # String length of the 1st element
|
echo ${#Fruits} # String length of the 1st element
|
||||||
|
|
Loading…
Reference in New Issue