Skip to content

Instantly share code, notes, and snippets.

@senorsmile
Created December 14, 2016 06:28
Show Gist options
  • Select an option

  • Save senorsmile/9c2c993b701134ad6bef34fe0ad490cf to your computer and use it in GitHub Desktop.

Select an option

Save senorsmile/9c2c993b701134ad6bef34fe0ad490cf to your computer and use it in GitHub Desktop.
array slicing in bash
#!/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