Invoke the bash shell via /usr/bin/env so that these scripts run on operating systems without /bin/bash too.

TEST=run "git cl owners" on FreeBSD
BUG=

Review URL: https://codereview.chromium.org/197213008

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@274320 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git-cache b/git-cache
index 586ad02..95eef4b 100755
--- a/git-cache
+++ b/git-cache
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-cl b/git-cl
index 7b17d25..e2082a4 100755
--- a/git-cl
+++ b/git-cl
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-crsync b/git-crsync
index 67b7ae7..2be2acd 100755
--- a/git-crsync
+++ b/git-crsync
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 . git-crup
diff --git a/git-crup b/git-crup
index 56b84c3..3b8cc69 100755
--- a/git-crup
+++ b/git-crup
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-freeze b/git-freeze
index 94e1cb6..0187c2e 100755
--- a/git-freeze
+++ b/git-freeze
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-lkgr b/git-lkgr
index ee8c3ed..c6a222d 100755
--- a/git-lkgr
+++ b/git-lkgr
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/git-map b/git-map
index b3399c0..3e651c7 100755
--- a/git-map
+++ b/git-map
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
@@ -6,4 +6,4 @@
 # git_map.py -- a git-command for presenting a graphical view of the git
 # history.
 
-. $(type -P python_git_runner.sh) | less -R
\ No newline at end of file
+. $(type -P python_git_runner.sh) | less -R
diff --git a/git-map-branches b/git-map-branches
index 3abb11d..b7da014 100755
--- a/git-map-branches
+++ b/git-map-branches
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-mark-merge-base b/git-mark-merge-base
index 285e435..502d04c 100755
--- a/git-mark-merge-base
+++ b/git-mark-merge-base
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-nav-downstream b/git-nav-downstream
index eb7c1f5..7f8a677 100755
--- a/git-nav-downstream
+++ b/git-nav-downstream
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-nav-upstream b/git-nav-upstream
index 98e7210..bec3eba 100755
--- a/git-nav-upstream
+++ b/git-nav-upstream
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-new-branch b/git-new-branch
index e08023c..fb56ee8 100755
--- a/git-new-branch
+++ b/git-new-branch
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-number b/git-number
index c311df9..e1d1298 100755
--- a/git-number
+++ b/git-number
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2013 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-rebase-update b/git-rebase-update
index 8eaaba3..60c16c3 100755
--- a/git-rebase-update
+++ b/git-rebase-update
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
@@ -6,4 +6,4 @@
 # git_rebase_update.py -- Update remote sources, and use rebase to update all
 # branches in this repo.
 
-. $(type -P python_git_runner.sh)
\ No newline at end of file
+. $(type -P python_git_runner.sh)
diff --git a/git-rename-branch b/git-rename-branch
index a082ae0..8c18884 100755
--- a/git-rename-branch
+++ b/git-rename-branch
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-reparent-branch b/git-reparent-branch
index b364e36..1fdb1ae 100755
--- a/git-reparent-branch
+++ b/git-reparent-branch
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
@@ -7,4 +7,4 @@
 # branch. Afterwards, run a `git rebase-update` cycle to ensure that all
 # branches correctly reflect their parentage.
 
-. $(type -P python_git_runner.sh)
\ No newline at end of file
+. $(type -P python_git_runner.sh)
diff --git a/git-runhooks b/git-runhooks
index 35af2ea..5bb503e 100755
--- a/git-runhooks
+++ b/git-runhooks
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 while test "$PWD" != "/"; do
   if test -f "$PWD/src/.gitmodules"; then
diff --git a/git-squash-branch b/git-squash-branch
index 6f9e79f..0fb1832 100755
--- a/git-squash-branch
+++ b/git-squash-branch
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 # git_squash_branch.py -- Collapses the current branch to a single commit.
 
-. $(type -P python_git_runner.sh)
\ No newline at end of file
+. $(type -P python_git_runner.sh)
diff --git a/git-thaw b/git-thaw
index 7978be2..74716f1 100755
--- a/git-thaw
+++ b/git-thaw
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-try b/git-try
index 68140ed..63c7d56 100755
--- a/git-try
+++ b/git-try
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/git-upstream-diff b/git-upstream-diff
index 964a530..7d44073 100755
--- a/git-upstream-diff
+++ b/git-upstream-diff
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2014 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/man/push_to_gs.sh b/man/push_to_gs.sh
index 22c8c29..00a5fbb 100755
--- a/man/push_to_gs.sh
+++ b/man/push_to_gs.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 MY_DIR=$(dirname "$(readlink "$0")")
 gsutil cp -r -z html -a public-read  "$MY_DIR/html" gs://chrome-infra-docs/flat/depot_tools/docs/
diff --git a/man/src/common_demo_functions.sh b/man/src/common_demo_functions.sh
index af7c906..8f85ad1 100755
--- a/man/src/common_demo_functions.sh
+++ b/man/src/common_demo_functions.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 REMOTE=$(pwd)/demo_repo
 
diff --git a/man/src/demo_repo.sh b/man/src/demo_repo.sh
index a07a47e..25bf4f0 100755
--- a/man/src/demo_repo.sh
+++ b/man/src/demo_repo.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 . common_demo_functions.sh
 
diff --git a/man/src/depot_tools_tutorial.demo.walkthrough.sh b/man/src/depot_tools_tutorial.demo.walkthrough.sh
index a7efa81..f5207cc 100755
--- a/man/src/depot_tools_tutorial.demo.walkthrough.sh
+++ b/man/src/depot_tools_tutorial.demo.walkthrough.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 BLANK_DEMO=1
 . demo_repo.sh
 
diff --git a/man/src/git-freeze.demo.1.sh b/man/src/git-freeze.demo.1.sh
index 397d183..82a0f1f 100755
--- a/man/src/git-freeze.demo.1.sh
+++ b/man/src/git-freeze.demo.1.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 . demo_repo.sh
 
 add deleted_file
diff --git a/man/src/git-map-branches.demo.1.sh b/man/src/git-map-branches.demo.1.sh
index add9249..c7fb70e 100755
--- a/man/src/git-map-branches.demo.1.sh
+++ b/man/src/git-map-branches.demo.1.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 . demo_repo.sh
 
 silent git branch no_upstream HEAD~
diff --git a/man/src/git-map.demo.1.sh b/man/src/git-map.demo.1.sh
index 2c46c89..ec3ee93 100755
--- a/man/src/git-map.demo.1.sh
+++ b/man/src/git-map.demo.1.sh
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/usr/bin/env bash
 . demo_repo.sh
 run git map
diff --git a/man/src/git-nav-downstream.demo.1.sh b/man/src/git-nav-downstream.demo.1.sh
index 2c0f5e5..d6a7743 100755
--- a/man/src/git-nav-downstream.demo.1.sh
+++ b/man/src/git-nav-downstream.demo.1.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 . demo_repo.sh
 
 silent git checkout origin/master
diff --git a/man/src/git-nav-upstream.demo.1.sh b/man/src/git-nav-upstream.demo.1.sh
index 206ed26..e0296bb 100755
--- a/man/src/git-nav-upstream.demo.1.sh
+++ b/man/src/git-nav-upstream.demo.1.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 . demo_repo.sh
 
 silent git checkout subfeature
diff --git a/man/src/git-new-branch.demo.1.sh b/man/src/git-new-branch.demo.1.sh
index 85eef05..b0ce57f 100755
--- a/man/src/git-new-branch.demo.1.sh
+++ b/man/src/git-new-branch.demo.1.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 . demo_repo.sh
 
 run git map-branches
diff --git a/man/src/git-squash-branch.demo.1.sh b/man/src/git-squash-branch.demo.1.sh
index 83cbce6..f43d7d6 100755
--- a/man/src/git-squash-branch.demo.1.sh
+++ b/man/src/git-squash-branch.demo.1.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 . demo_repo.sh
 
 run git map
diff --git a/man/src/make_docs.sh b/man/src/make_docs.sh
index d011a61..73d76e2 100755
--- a/man/src/make_docs.sh
+++ b/man/src/make_docs.sh
@@ -1,4 +1,7 @@
-#!/bin/bash -e
+#!/usr/bin/env bash
+
+set -e
+
 shopt -s nullglob
 
 cd $(dirname "$0")
diff --git a/man/src/prep_demo_repo.sh b/man/src/prep_demo_repo.sh
index 241097c..f267a9f 100755
--- a/man/src/prep_demo_repo.sh
+++ b/man/src/prep_demo_repo.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 NO_AUTOPREP=True
 . common_demo_functions.sh
diff --git a/ninja b/ninja
index 7b76038..063c87a 100755
--- a/ninja
+++ b/ninja
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 Google Inc. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/testing_support/gerrit-init.sh b/testing_support/gerrit-init.sh
index 4884a3c..2ea7230 100755
--- a/testing_support/gerrit-init.sh
+++ b/testing_support/gerrit-init.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/tests/abandon.sh b/tests/abandon.sh
index ab33751..da4cf7f 100755
--- a/tests/abandon.sh
+++ b/tests/abandon.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/basic.sh b/tests/basic.sh
index e8b3682..85dedae 100755
--- a/tests/basic.sh
+++ b/tests/basic.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/hooks.sh b/tests/hooks.sh
index d890ce6..d0c9a6f 100755
--- a/tests/hooks.sh
+++ b/tests/hooks.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/owners.sh b/tests/owners.sh
index 28dd7c9..853fcf7 100755
--- a/tests/owners.sh
+++ b/tests/owners.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/patch.sh b/tests/patch.sh
index d9c6612..22f6c21 100755
--- a/tests/patch.sh
+++ b/tests/patch.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/post-dcommit-hook-test.sh b/tests/post-dcommit-hook-test.sh
index a047fc1..ec4e4d0 100755
--- a/tests/post-dcommit-hook-test.sh
+++ b/tests/post-dcommit-hook-test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
@@ -16,7 +16,7 @@
   cd git-svn
 
   cat > .git/hooks/post-cl-dcommit << _EOF
-#!/bin/bash
+#!/usr/bin/env bash
 git branch -m COMMITTED
 _EOF
   chmod +x .git/hooks/post-cl-dcommit
diff --git a/tests/push-basic.sh b/tests/push-basic.sh
index 18936c1..51a74f0 100755
--- a/tests/push-basic.sh
+++ b/tests/push-basic.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/push-from-logs.sh b/tests/push-from-logs.sh
index a81c513..0fef2a7 100755
--- a/tests/push-from-logs.sh
+++ b/tests/push-from-logs.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/rename.sh b/tests/rename.sh
index 03635a2..b16bea1 100755
--- a/tests/rename.sh
+++ b/tests/rename.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/save-description-on-failure.sh b/tests/save-description-on-failure.sh
index 6952ac0..3584688 100755
--- a/tests/save-description-on-failure.sh
+++ b/tests/save-description-on-failure.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/submit-from-new-dir.sh b/tests/submit-from-new-dir.sh
index ec9f4d5..f04d9dc 100755
--- a/tests/submit-from-new-dir.sh
+++ b/tests/submit-from-new-dir.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/submodule-merge-test.sh b/tests/submodule-merge-test.sh
index 31186ae..8818a2a 100755
--- a/tests/submodule-merge-test.sh
+++ b/tests/submodule-merge-test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 4c19010..1e7223d 100755
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/upload-local-tracking-branch.sh b/tests/upload-local-tracking-branch.sh
index b7602d3..0efd6e0 100755
--- a/tests/upload-local-tracking-branch.sh
+++ b/tests/upload-local-tracking-branch.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/upload-stale.sh b/tests/upload-stale.sh
index ddc57cc..72d1ad3 100755
--- a/tests/upload-stale.sh
+++ b/tests/upload-stale.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/tests/upstream.sh b/tests/upstream.sh
index b3ff0ac..8c91ebf 100755
--- a/tests/upstream.sh
+++ b/tests/upstream.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be