{"action":"created","issue":{"url":"https://api.github.com/repos/koalaman/shellcheck/issues/1141","repository_url":"https://api.github.com/repos/koalaman/shellcheck","labels_url":"https://api.github.com/repos/koalaman/shellcheck/issues/1141/labels{/name}","comments_url":"https://api.github.com/repos/koalaman/shellcheck/issues/1141/comments","events_url":"https://api.github.com/repos/koalaman/shellcheck/issues/1141/events","html_url":"https://github.com/koalaman/shellcheck/issues/1141","id":303968658,"number":1141,"title":"SC2124 incorrectly triggered on array indexing","user":{"login":"cdown","id":660663,"avatar_url":"https://avatars1.githubusercontent.com/u/660663?v=4","gravatar_id":"","url":"https://api.github.com/users/cdown","html_url":"https://github.com/cdown","followers_url":"https://api.github.com/users/cdown/followers","following_url":"https://api.github.com/users/cdown/following{/other_user}","gists_url":"https://api.github.com/users/cdown/gists{/gist_id}","starred_url":"https://api.github.com/users/cdown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdown/subscriptions","organizations_url":"https://api.github.com/users/cdown/orgs","repos_url":"https://api.github.com/users/cdown/repos","events_url":"https://api.github.com/users/cdown/events{/privacy}","received_events_url":"https://api.github.com/users/cdown/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-09T20:22:13Z","updated_at":"2018-03-09T20:25:55Z","closed_at":null,"author_association":"NONE","body":"#### For bugs\r\n- Rule Id (if any, e.g. SC1000): SC2124\r\n- My shellcheck version (`shellcheck --version` or \"online\"): 0.4.7\r\n- [x] I tried on shellcheck.net and verified that this is still a problem on the latest commit\r\n- [ ] It's not reproducible on shellcheck.net, but I think that's because it's an OS, configuration or encoding issue\r\n\r\n\r\n#### Here's a snippet or screenshot that shows the problem:\r\n\r\n`${@: -1}` here is a specific index, not an array:\r\n\r\n```sh\r\n$ cat script\r\n#!/bin/bash\r\n\r\nfoo=\"${@: -1}\"\r\necho \"$foo\"\r\n$ ./script\r\n./script\r\n$ shellcheck script\r\n\r\nIn script line 3:\r\nfoo=\"${@: -1}\"\r\n    ^-- SC2124: Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.\r\n```\r\n\r\nFound when reviewing https://github.com/cdown/clipmenu/pull/68."},"comment":{"url":"https://api.github.com/repos/koalaman/shellcheck/issues/comments/371935769","html_url":"https://github.com/koalaman/shellcheck/issues/1141#issuecomment-371935769","issue_url":"https://api.github.com/repos/koalaman/shellcheck/issues/1141","id":371935769,"user":{"login":"cdown","id":660663,"avatar_url":"https://avatars1.githubusercontent.com/u/660663?v=4","gravatar_id":"","url":"https://api.github.com/users/cdown","html_url":"https://github.com/cdown","followers_url":"https://api.github.com/users/cdown/followers","following_url":"https://api.github.com/users/cdown/following{/other_user}","gists_url":"https://api.github.com/users/cdown/gists{/gist_id}","starred_url":"https://api.github.com/users/cdown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdown/subscriptions","organizations_url":"https://api.github.com/users/cdown/orgs","repos_url":"https://api.github.com/users/cdown/repos","events_url":"https://api.github.com/users/cdown/events{/privacy}","received_events_url":"https://api.github.com/users/cdown/received_events","type":"User","site_admin":false},"created_at":"2018-03-09T20:25:55Z","updated_at":"2018-03-09T20:25:55Z","author_association":"NONE","body":"I kind of get that this behaviour is derived from cases where `-2`/`-3`/etc are used, but in this case it's impossible for `-1` to reference more than one element"}}
{"actor":{"display_login":"cdown"}}