Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Declaring arrays in Bash is similar to declaring tuples in Python
- array=('1' '2' 2 5)
- # You can set any index of an array to be a value in Bash, What this does is allocate 1000 - 4 values and sets the last index to 100
- array[1000]=100
- # Delete the 1000th index
- unset array[1000]
- # Print values of all elements in array
- echo "${array[@]}"
- # Print indexes of all elements in array
- echo "${!array[@]}"
- # Print length of array
- echo "${#array[@]}"
- # Print 0th element of array
- echo "${array[0]}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement