Created
December 14, 2016 06:28
-
-
Save senorsmile/9c2c993b701134ad6bef34fe0ad490cf to your computer and use it in GitHub Desktop.
array slicing in bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| array=(zero one two three four five) | |
| echo "${array[@]:1:3}" | |
| ## one two three | |
| echo "${array[@]:3}" | |
| ## three four five | |
| echo "${array[@]::2}" | |
| ## zero one |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment