Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 2
    Make that "${a[@]: -1}" and it will work (besides bash and zsh) also in ksh. Commented Apr 27, 2015 at 5:09
  • The Kornshell docs (www2.research.att.com/sw/download/man/man1/ksh.html) specify it completely. (Haven't inspected the docs of zsh or bash; but I tested it in all three shells.) Commented Apr 27, 2015 at 5:20
  • @Janis: re-read bash documentation, it also mentioned about this one, too. Thanks again. Commented Apr 27, 2015 at 5:21
  • You can also check gnu.org/software/bash/manual/html_node/… for the negative offset usage. Commented Sep 9, 2024 at 3:36