[PATCH] Unhardcode /bin/bash

Brian Callahan bcallah at devio.us
Tue Aug 12 13:55:50 CEST 2014


Hi --

As the subject line says, this unhardcodes /bin/bash to /usr/bin/env bash.
This eases packing on the BSDs, and probably other systems, that do not 
put bash in /bin.

Generated from
perl -pi -e "s,^#!/bin/bash,#!/usr/bin/env bash,g" `grep -Rl /bin/bash *`
from the top of the hlwm tree.

This is what I have to do as the OpenBSD port maintainer of hlwm to get 
hlwm to work.

Please CC me on any replies, I am not subscribed to this list.

Thanks!

~Brian

 From 69171fd592c838f1c627ac42b67596771e6adcc8 Mon Sep 17 00:00:00 2001
From: Brian Callahan <bcallah at openbsd.org>
Date: Tue, 12 Aug 2014 07:42:54 -0400
Subject: [PATCH] Unhardcode /bin/bash

Eases packaging for systems that do not put bash in /bin, such as the 
BSDs (who put bash in /usr/local/bin).
---
  release.sh                 | 2 +-
  scripts/dmenu.sh           | 2 +-
  scripts/dumpbeautify.sh    | 2 +-
  scripts/exec_on_tag.sh     | 2 +-
  scripts/execwith.sh        | 2 +-
  scripts/floatmon.sh        | 2 +-
  scripts/herbstcommander.sh | 2 +-
  scripts/keychain.sh        | 2 +-
  scripts/lasttag.sh         | 2 +-
  scripts/layout.sh          | 2 +-
  scripts/loadstate.sh       | 2 +-
  scripts/q3terminal.sh      | 2 +-
  scripts/savestate.sh       | 2 +-
  scripts/scratchpad.sh      | 2 +-
  scripts/wselect.sh         | 2 +-
  share/autostart            | 2 +-
  share/dmenu_run_hlwm       | 2 +-
  share/panel.sh             | 2 +-
  share/restartpanels.sh     | 2 +-
  www/faq.txt                | 2 +-
  www/gentoc.sh              | 2 +-
  21 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/release.sh b/release.sh
index 6108bb1..6af1c65 100755
--- a/release.sh
+++ b/release.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  version="$1"

diff --git a/scripts/dmenu.sh b/scripts/dmenu.sh
index 053b45d..b3b4ebf 100755
--- a/scripts/dmenu.sh
+++ b/scripts/dmenu.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  dm() { "${dmenu_command[@]:-dmenu}" "$@" ;}
  hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
diff --git a/scripts/dumpbeautify.sh b/scripts/dumpbeautify.sh
index 423d167..0a1a790 100755
--- a/scripts/dumpbeautify.sh
+++ b/scripts/dumpbeautify.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # aligns the output of dump command as a nice tree
  # usage:
diff --git a/scripts/exec_on_tag.sh b/scripts/exec_on_tag.sh
index f2758ed..f2f64d9 100755
--- a/scripts/exec_on_tag.sh
+++ b/scripts/exec_on_tag.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}

diff --git a/scripts/execwith.sh b/scripts/execwith.sh
index 775197d..34f188d 100755
--- a/scripts/execwith.sh
+++ b/scripts/execwith.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # exec a script $2... with settings from rc-file $1
  # useful for various dmenu scripts, e.g.:
diff --git a/scripts/floatmon.sh b/scripts/floatmon.sh
index 48cad41..0d93be3 100755
--- a/scripts/floatmon.sh
+++ b/scripts/floatmon.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  monitor=floatmon
  tag=fl
diff --git a/scripts/herbstcommander.sh b/scripts/herbstcommander.sh
index 4698bb2..efe5f20 100755
--- a/scripts/herbstcommander.sh
+++ b/scripts/herbstcommander.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # herbstcommander.sh - launch herbstluftwm-commands via dmenu
  # Written by Florian Bruhin <me at the-compiler.org>
diff --git a/scripts/keychain.sh b/scripts/keychain.sh
index 1ac1c0f..764cdb4 100755
--- a/scripts/keychain.sh
+++ b/scripts/keychain.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # Execute this (e.g. from your autostart) to obtain basic key chaining 
like it
  # is known from other applications like screen.
diff --git a/scripts/lasttag.sh b/scripts/lasttag.sh
index a6f951d..dd89314 100755
--- a/scripts/lasttag.sh
+++ b/scripts/lasttag.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # usage: start this script in anywhere your autostart (but *after* the
  # emit_hook reload line)
diff --git a/scripts/layout.sh b/scripts/layout.sh
index fbac24f..5253c26 100755
--- a/scripts/layout.sh
+++ b/scripts/layout.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # print layout of all tags, and colorizes all window ids
  # it's useful to get a overview over the list of all windows
diff --git a/scripts/loadstate.sh b/scripts/loadstate.sh
index 5a781f8..5954276 100755
--- a/scripts/loadstate.sh
+++ b/scripts/loadstate.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}

diff --git a/scripts/q3terminal.sh b/scripts/q3terminal.sh
index bae9e89..2ca9fd3 100755
--- a/scripts/q3terminal.sh
+++ b/scripts/q3terminal.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # a q3-like (or yakuake-like) terminal for arbitrary applications.
  #
diff --git a/scripts/savestate.sh b/scripts/savestate.sh
index 74e597b..00e102d 100755
--- a/scripts/savestate.sh
+++ b/scripts/savestate.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}

diff --git a/scripts/scratchpad.sh b/scripts/scratchpad.sh
index 06ba00a..b3a9177 100755
--- a/scripts/scratchpad.sh
+++ b/scripts/scratchpad.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # a i3-like scratchpad for arbitrary applications.
  #
diff --git a/scripts/wselect.sh b/scripts/wselect.sh
index de45d4c..c967e05 100755
--- a/scripts/wselect.sh
+++ b/scripts/wselect.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # a window selection utility
  # dependencies: wmctrl, awk,
diff --git a/share/autostart b/share/autostart
index 252db1d..1808205 100755
--- a/share/autostart
+++ b/share/autostart
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # this is a simple config for herbstluftwm

diff --git a/share/dmenu_run_hlwm b/share/dmenu_run_hlwm
index ec20972..d8cb36c 100755
--- a/share/dmenu_run_hlwm
+++ b/share/dmenu_run_hlwm
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  if ! command -v dmenu > /dev/null 2>/dev/null ; then
      echo "Error: Requirement dmenu not found in your PATH." >&2
diff --git a/share/panel.sh b/share/panel.sh
index 1cab57e..e40ab9d 100755
--- a/share/panel.sh
+++ b/share/panel.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
  monitor=${1:-0}
diff --git a/share/restartpanels.sh b/share/restartpanels.sh
index 9d9110c..774208d 100755
--- a/share/restartpanels.sh
+++ b/share/restartpanels.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  installdir=/

diff --git a/www/faq.txt b/www/faq.txt
index f8ca223..131b4be 100644
--- a/www/faq.txt
+++ b/www/faq.txt
@@ -154,7 +154,7 @@ Add a rule for the clients pid, before the client 
appears. This script
  creates two xterms with different behaviours:

  ----
-#!/bin/bash
+#!/usr/bin/env bash

  # Requirement: bash >= 4.0 (because of the usage of $BASHPID)

diff --git a/www/gentoc.sh b/www/gentoc.sh
index 3f8bfe7..dc44e67 100755
--- a/www/gentoc.sh
+++ b/www/gentoc.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

  # if you know a cleaner version then grepping everything out of html
  # then you are very welcome to improve this script!
-- 
1.9.3




More information about the hlwm mailing list