Slicing an array in zsh
03 Mar 2023To get only part of a specific array in zsh, you have to use the [@]:X:Y
syntax, where X
is the start of your slice and Y
the end of it.
You can omit the Y
or use negative indices.
For example, ${myArray[@]:2}
slices the array by removing its first element
Want to add something ? Feel free to get in touch on Bluesky : @pixelastic.bsky.social