{"id":7901,"date":"2026-03-11T08:49:04","date_gmt":"2026-03-11T06:49:04","guid":{"rendered":"https:\/\/mummila.net\/kommentit\/?p=7901"},"modified":"2026-03-11T08:49:04","modified_gmt":"2026-03-11T06:49:04","slug":"this-is-a-somewhat-contrived-example","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2026\/03\/11\/this-is-a-somewhat-contrived-example\/","title":{"rendered":"This is a somewhat contrived example"},"content":{"rendered":"<p>I noticed that for the specific case of picking an element from the end using just the size of the array itself, the above is a somewhat contrived example; a plain -1 would work just as well. But I can change the example script as below, and the difference between outputs still holds:<\/p>\n<pre><code>#!\/bin\/bash\r\n\r\narray=(\r\n    \"a\"\r\n    \"b\"\r\n    \"c\"\r\n)\r\n\r\ni=3\r\n\r\nvalue=\"${array[i - 1]}\"\r\n\r\nprintf \"%s\\n\" \"${value}\"<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A plain -1 would work just as well. But I can change the example script as below, and the difference between outputs still holds.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8860],"tags":[23032],"class_list":["post-7901","post","type-post","status-publish","format-standard","hentry","category-vianhallintajarjestelmat","tag-shfmt","sijainti-github"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/7901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=7901"}],"version-history":[{"count":1,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/7901\/revisions"}],"predecessor-version":[{"id":7902,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/7901\/revisions\/7902"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=7901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=7901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=7901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}