Merge pull request #1462 from kozhemyak/patch/add-bash-lastindex

Add a way to get the last element
This commit is contained in:
Rico Sta. Cruz 2020-06-17 23:22:27 +10:00 committed by GitHub
commit 214a4ed82e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -455,6 +455,7 @@ Fruits[2]="Orange"
```bash
echo ${Fruits[0]} # Element #0
echo ${Fruits[-1]} # Last element
echo ${Fruits[@]} # All elements, space-separated
echo ${#Fruits[@]} # Number of elements
echo ${#Fruits} # String length of the 1st element