{"action":"created","issue":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2773","repository_url":"https://api.github.com/repos/fish-shell/fish-shell","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2773/labels{/name}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2773/comments","events_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2773/events","html_url":"https://github.com/fish-shell/fish-shell/issues/2773","id":136994571,"number":2773,"title":"helping new users used to writing \"if $status\"","user":{"login":"krader1961","id":7545917,"avatar_url":"https://avatars.githubusercontent.com/u/7545917?v=3","gravatar_id":"","url":"https://api.github.com/users/krader1961","html_url":"https://github.com/krader1961","followers_url":"https://api.github.com/users/krader1961/followers","following_url":"https://api.github.com/users/krader1961/following{/other_user}","gists_url":"https://api.github.com/users/krader1961/gists{/gist_id}","starred_url":"https://api.github.com/users/krader1961/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krader1961/subscriptions","organizations_url":"https://api.github.com/users/krader1961/orgs","repos_url":"https://api.github.com/users/krader1961/repos","events_url":"https://api.github.com/users/krader1961/events{/privacy}","received_events_url":"https://api.github.com/users/krader1961/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fish-shell/fish-shell/labels/Easy%20Pick","name":"Easy Pick","color":"fbca04"},{"url":"https://api.github.com/repos/fish-shell/fish-shell/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/fish-shell/fish-shell/milestones/4","html_url":"https://github.com/fish-shell/fish-shell/milestones/fish-future","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/milestones/4/labels","id":130257,"number":4,"title":"fish-future","description":"These are bugs that are not targeted for an upcoming release. After a release, we will reexamine these bugs and pull any in that we think are good targets.\r\n\r\nIf you can provide a fix for a bug in this milestone, we'll generally accept it for the next release even if the bug is not in the release.","creator":{"login":"ridiculousfish","id":920838,"avatar_url":"https://avatars.githubusercontent.com/u/920838?v=3","gravatar_id":"","url":"https://api.github.com/users/ridiculousfish","html_url":"https://github.com/ridiculousfish","followers_url":"https://api.github.com/users/ridiculousfish/followers","following_url":"https://api.github.com/users/ridiculousfish/following{/other_user}","gists_url":"https://api.github.com/users/ridiculousfish/gists{/gist_id}","starred_url":"https://api.github.com/users/ridiculousfish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ridiculousfish/subscriptions","organizations_url":"https://api.github.com/users/ridiculousfish/orgs","repos_url":"https://api.github.com/users/ridiculousfish/repos","events_url":"https://api.github.com/users/ridiculousfish/events{/privacy}","received_events_url":"https://api.github.com/users/ridiculousfish/received_events","type":"User","site_admin":false},"open_issues":373,"closed_issues":4,"state":"open","created_at":"2012-06-11T02:25:13Z","updated_at":"2016-02-28T12:51:00Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2016-02-28T02:13:11Z","updated_at":"2016-02-28T16:53:44Z","closed_at":null,"body":"Someone recently asked on [StackOverflow](http://stackoverflow.com/questions/35660206/variables-may-not-be-used-as-commands) what the fish equivalent is for a bash block of this form:\r\n\r\n```\r\nif $status; then\r\n    echo success\r\nelse\r\n     echo failure\r\nfi\r\n```\r\n\r\nThey were stymied by the unhelpful feedback they received for the `if $status`:\r\n\r\n> fish: Variables may not be used as commands. Instead, define a function like “function status; 0 $argv; end”. See the help section for the function command by typing “help function”.\r\n\r\nNor did they find the documentation helpful.\r\n\r\nI think we can do a few things to help new users with this specific issue. First, the \"Exit Status\" section in the fish tutorial could include some verbiage about testing exit status the fish way; i.e., `if test $status -eq 0` or other value if `if command` isn't appropriate. Second, improve the wording on the *test* man page -- especially the summary (\"perform tests on files and text\"). Third, augment the feedback that says \"Variables may not be used as commands.\" to mention eval and test. As a stretch goal make the feedback context aware; i.e., if the context is `if $status` replace the current feedback with an appropriate example using test."},"comment":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/comments/189902032","html_url":"https://github.com/fish-shell/fish-shell/issues/2773#issuecomment-189902032","issue_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2773","id":189902032,"user":{"login":"faho","id":5185367,"avatar_url":"https://avatars.githubusercontent.com/u/5185367?v=3","gravatar_id":"","url":"https://api.github.com/users/faho","html_url":"https://github.com/faho","followers_url":"https://api.github.com/users/faho/followers","following_url":"https://api.github.com/users/faho/following{/other_user}","gists_url":"https://api.github.com/users/faho/gists{/gist_id}","starred_url":"https://api.github.com/users/faho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faho/subscriptions","organizations_url":"https://api.github.com/users/faho/orgs","repos_url":"https://api.github.com/users/faho/repos","events_url":"https://api.github.com/users/faho/events{/privacy}","received_events_url":"https://api.github.com/users/faho/received_events","type":"User","site_admin":false},"created_at":"2016-02-28T16:53:44Z","updated_at":"2016-02-28T16:53:44Z","body":"@DraTeots: Does 60bd3c8 help?"}}