{"action":"created","comment":{"url":"https://api.github.com/repos/Originate/git-town/pulls/comments/41110599","id":41110599,"diff_hunk":"@@ -0,0 +1,233 @@\n+# A Flash of Bash\n+\n+Git Town is written in Bash.\n+Bash is a surprisingly powerful, versatile, and elaborate scripting system\n+where every command-line application becomes a keyword in your programming language.\n+\n+With the right amount of structure,\n+Bash programs can be as easily written and read\n+as programs in many other languages.\n+\n+Bash is the\n+[9th most popular language on GitHub](http://githut.info),\n+and actively used in most open-source repositories.\n+\n+Learning Bash not only allows you to contribute to Git Town,\n+it will make your life easier by giving you the ability to\n+create a plethora of useful little command-line helpers,\n+the UNIX way!\n+\n+* [Shebang](#shebang)\n+* [Variables](#variables)\n+* [If clauses](#if-clauses)\n+* [Functions](#functions)\n+* [Arrays](#arrays)\n+* [String Lists](#string-lists)\n+* [Converting](#converting)\n+\n+\n+## Shebang\n+\n+Use the cross-platform version of shebang:\n+```bash\n+#!/usr/bin/env bash\n+```\n+\n+\n+## Variables\n+\n+* declaring variables\n+\n+  ```bash\n+  name=\"Git Town\"\n+  ```\n+* declaring local variables\n+\n+  ```bash\n+  local name=\"Git Town\"\n+  ```\n+* declaring constants:\n+\n+  ```bash\n+  NAME=\"Git Town\"\n+  ```\n+\n+## If clauses\n+\n+* structure\n+\n+  ```bash\n+  if [condition]; then\n+    # code\n+  elif [condition]; then\n+    # code\n+  else\n+    # code\n+  fi\n+  ```\n+\n+* negation\n+\n+  ```bash\n+  if [ ! condition ]; then\n+    # runs if the condition is not true\n+  ```\n+* checking booleans\n+\n+  ```bash\n+  if [ $success = true ]; then\n+    # :)\n+  fi\n+  ```\n+* checking strings\n+\n+  ```bash\n+  if [ $mood = \"happy\" ]; then\n+  ```\n+* checking for empty strings\n+\n+  ```bash\n+  if [ -z $input ]; then\n+  ```\n+\n+* checking whether a file exists\n+\n+  ```bash\n+  if [ -e $filename ]; then\n+  ```\n+\n+\n+## Functions\n+\n+* defining functions\n+\n+  ```bash\n+  function add_user {\n+    local name=$1\n+    echo \"adding user $name\"\n+  }\n+  ```\n+\n+  Notice how the first parameter is given a name\n+  by assigning it\n+  to the local variable `bar`.","path":"documentation/bash_cheatsheet.md","position":113,"original_position":113,"commit_id":"2f192713ffb2579f81c18dd5d6eb1d7d1d6e63a9","original_commit_id":"2f192713ffb2579f81c18dd5d6eb1d7d1d6e63a9","user":{"login":"allewun","id":1256911,"avatar_url":"https://avatars.githubusercontent.com/u/1256911?v=3","gravatar_id":"","url":"https://api.github.com/users/allewun","html_url":"https://github.com/allewun","followers_url":"https://api.github.com/users/allewun/followers","following_url":"https://api.github.com/users/allewun/following{/other_user}","gists_url":"https://api.github.com/users/allewun/gists{/gist_id}","starred_url":"https://api.github.com/users/allewun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allewun/subscriptions","organizations_url":"https://api.github.com/users/allewun/orgs","repos_url":"https://api.github.com/users/allewun/repos","events_url":"https://api.github.com/users/allewun/events{/privacy}","received_events_url":"https://api.github.com/users/allewun/received_events","type":"User","site_admin":false},"body":"to the local variable `$name`","created_at":"2015-10-05T04:54:40Z","updated_at":"2015-10-05T04:54:40Z","html_url":"https://github.com/Originate/git-town/pull/670#discussion_r41110599","pull_request_url":"https://api.github.com/repos/Originate/git-town/pulls/670","_links":{"self":{"href":"https://api.github.com/repos/Originate/git-town/pulls/comments/41110599"},"html":{"href":"https://github.com/Originate/git-town/pull/670#discussion_r41110599"},"pull_request":{"href":"https://api.github.com/repos/Originate/git-town/pulls/670"}}},"pull_request":{"url":"https://api.github.com/repos/Originate/git-town/pulls/670","id":46294004,"html_url":"https://github.com/Originate/git-town/pull/670","diff_url":"https://github.com/Originate/git-town/pull/670.diff","patch_url":"https://github.com/Originate/git-town/pull/670.patch","issue_url":"https://api.github.com/repos/Originate/git-town/issues/670","number":670,"state":"open","locked":false,"title":"Bash documentation","user":{"login":"kevgo","id":268934,"avatar_url":"https://avatars.githubusercontent.com/u/268934?v=3","gravatar_id":"","url":"https://api.github.com/users/kevgo","html_url":"https://github.com/kevgo","followers_url":"https://api.github.com/users/kevgo/followers","following_url":"https://api.github.com/users/kevgo/following{/other_user}","gists_url":"https://api.github.com/users/kevgo/gists{/gist_id}","starred_url":"https://api.github.com/users/kevgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevgo/subscriptions","organizations_url":"https://api.github.com/users/kevgo/orgs","repos_url":"https://api.github.com/users/kevgo/repos","events_url":"https://api.github.com/users/kevgo/events{/privacy}","received_events_url":"https://api.github.com/users/kevgo/received_events","type":"User","site_admin":false},"body":"@charlierudolph @allewun @ricmatsui \r\n\r\nI think it makes sense to document how to use Bash. This is a start.","created_at":"2015-09-29T15:38:57Z","updated_at":"2015-10-05T04:54:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a037abacb1eb9c7714fe5d57626ca00f20fb9fb8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Originate/git-town/pulls/670/commits","review_comments_url":"https://api.github.com/repos/Originate/git-town/pulls/670/comments","review_comment_url":"https://api.github.com/repos/Originate/git-town/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Originate/git-town/issues/670/comments","statuses_url":"https://api.github.com/repos/Originate/git-town/statuses/2f192713ffb2579f81c18dd5d6eb1d7d1d6e63a9","head":{"label":"Originate:kg-bash-flash","ref":"kg-bash-flash","sha":"2f192713ffb2579f81c18dd5d6eb1d7d1d6e63a9","user":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"repo":{"id":19825320,"name":"git-town","full_name":"Originate/git-town","owner":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Originate/git-town","description":"Generic, high-level Git workflow support! ","fork":false,"url":"https://api.github.com/repos/Originate/git-town","forks_url":"https://api.github.com/repos/Originate/git-town/forks","keys_url":"https://api.github.com/repos/Originate/git-town/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Originate/git-town/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Originate/git-town/teams","hooks_url":"https://api.github.com/repos/Originate/git-town/hooks","issue_events_url":"https://api.github.com/repos/Originate/git-town/issues/events{/number}","events_url":"https://api.github.com/repos/Originate/git-town/events","assignees_url":"https://api.github.com/repos/Originate/git-town/assignees{/user}","branches_url":"https://api.github.com/repos/Originate/git-town/branches{/branch}","tags_url":"https://api.github.com/repos/Originate/git-town/tags","blobs_url":"https://api.github.com/repos/Originate/git-town/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Originate/git-town/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Originate/git-town/git/refs{/sha}","trees_url":"https://api.github.com/repos/Originate/git-town/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Originate/git-town/statuses/{sha}","languages_url":"https://api.github.com/repos/Originate/git-town/languages","stargazers_url":"https://api.github.com/repos/Originate/git-town/stargazers","contributors_url":"https://api.github.com/repos/Originate/git-town/contributors","subscribers_url":"https://api.github.com/repos/Originate/git-town/subscribers","subscription_url":"https://api.github.com/repos/Originate/git-town/subscription","commits_url":"https://api.github.com/repos/Originate/git-town/commits{/sha}","git_commits_url":"https://api.github.com/repos/Originate/git-town/git/commits{/sha}","comments_url":"https://api.github.com/repos/Originate/git-town/comments{/number}","issue_comment_url":"https://api.github.com/repos/Originate/git-town/issues/comments{/number}","contents_url":"https://api.github.com/repos/Originate/git-town/contents/{+path}","compare_url":"https://api.github.com/repos/Originate/git-town/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Originate/git-town/merges","archive_url":"https://api.github.com/repos/Originate/git-town/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Originate/git-town/downloads","issues_url":"https://api.github.com/repos/Originate/git-town/issues{/number}","pulls_url":"https://api.github.com/repos/Originate/git-town/pulls{/number}","milestones_url":"https://api.github.com/repos/Originate/git-town/milestones{/number}","notifications_url":"https://api.github.com/repos/Originate/git-town/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Originate/git-town/labels{/name}","releases_url":"https://api.github.com/repos/Originate/git-town/releases{/id}","created_at":"2014-05-15T15:44:29Z","updated_at":"2015-10-02T17:11:38Z","pushed_at":"2015-10-05T04:41:31Z","git_url":"git://github.com/Originate/git-town.git","ssh_url":"git@github.com:Originate/git-town.git","clone_url":"https://github.com/Originate/git-town.git","svn_url":"https://github.com/Originate/git-town","homepage":"http://www.git-town.com","size":13552,"stargazers_count":109,"watchers_count":109,"language":"Cucumber","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":54,"forks":7,"open_issues":54,"watchers":109,"default_branch":"master"}},"base":{"label":"Originate:master","ref":"master","sha":"2b77a8e3639e2a9a591337d44d8dc8131294252e","user":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"repo":{"id":19825320,"name":"git-town","full_name":"Originate/git-town","owner":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Originate/git-town","description":"Generic, high-level Git workflow support! ","fork":false,"url":"https://api.github.com/repos/Originate/git-town","forks_url":"https://api.github.com/repos/Originate/git-town/forks","keys_url":"https://api.github.com/repos/Originate/git-town/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Originate/git-town/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Originate/git-town/teams","hooks_url":"https://api.github.com/repos/Originate/git-town/hooks","issue_events_url":"https://api.github.com/repos/Originate/git-town/issues/events{/number}","events_url":"https://api.github.com/repos/Originate/git-town/events","assignees_url":"https://api.github.com/repos/Originate/git-town/assignees{/user}","branches_url":"https://api.github.com/repos/Originate/git-town/branches{/branch}","tags_url":"https://api.github.com/repos/Originate/git-town/tags","blobs_url":"https://api.github.com/repos/Originate/git-town/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Originate/git-town/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Originate/git-town/git/refs{/sha}","trees_url":"https://api.github.com/repos/Originate/git-town/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Originate/git-town/statuses/{sha}","languages_url":"https://api.github.com/repos/Originate/git-town/languages","stargazers_url":"https://api.github.com/repos/Originate/git-town/stargazers","contributors_url":"https://api.github.com/repos/Originate/git-town/contributors","subscribers_url":"https://api.github.com/repos/Originate/git-town/subscribers","subscription_url":"https://api.github.com/repos/Originate/git-town/subscription","commits_url":"https://api.github.com/repos/Originate/git-town/commits{/sha}","git_commits_url":"https://api.github.com/repos/Originate/git-town/git/commits{/sha}","comments_url":"https://api.github.com/repos/Originate/git-town/comments{/number}","issue_comment_url":"https://api.github.com/repos/Originate/git-town/issues/comments{/number}","contents_url":"https://api.github.com/repos/Originate/git-town/contents/{+path}","compare_url":"https://api.github.com/repos/Originate/git-town/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Originate/git-town/merges","archive_url":"https://api.github.com/repos/Originate/git-town/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Originate/git-town/downloads","issues_url":"https://api.github.com/repos/Originate/git-town/issues{/number}","pulls_url":"https://api.github.com/repos/Originate/git-town/pulls{/number}","milestones_url":"https://api.github.com/repos/Originate/git-town/milestones{/number}","notifications_url":"https://api.github.com/repos/Originate/git-town/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Originate/git-town/labels{/name}","releases_url":"https://api.github.com/repos/Originate/git-town/releases{/id}","created_at":"2014-05-15T15:44:29Z","updated_at":"2015-10-02T17:11:38Z","pushed_at":"2015-10-05T04:41:31Z","git_url":"git://github.com/Originate/git-town.git","ssh_url":"git@github.com:Originate/git-town.git","clone_url":"https://github.com/Originate/git-town.git","svn_url":"https://github.com/Originate/git-town","homepage":"http://www.git-town.com","size":13552,"stargazers_count":109,"watchers_count":109,"language":"Cucumber","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":54,"forks":7,"open_issues":54,"watchers":109,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Originate/git-town/pulls/670"},"html":{"href":"https://github.com/Originate/git-town/pull/670"},"issue":{"href":"https://api.github.com/repos/Originate/git-town/issues/670"},"comments":{"href":"https://api.github.com/repos/Originate/git-town/issues/670/comments"},"review_comments":{"href":"https://api.github.com/repos/Originate/git-town/pulls/670/comments"},"review_comment":{"href":"https://api.github.com/repos/Originate/git-town/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Originate/git-town/pulls/670/commits"},"statuses":{"href":"https://api.github.com/repos/Originate/git-town/statuses/2f192713ffb2579f81c18dd5d6eb1d7d1d6e63a9"}}}}