Permalink
Browse files

Fail better when run under /bin/sh.

  • Loading branch information...
1 parent 520bd44 commit deeae4d1e87543ea338eab24082a76ed6dd14ad3 @ingydotnet committed with ryanjosephking Jun 11, 2012
Showing with 28 additions and 0 deletions.
  1. +15 −0 lib/assert-decent-shell
  2. +2 −0 lib/basics
  3. +2 −0 lib/path-manip
  4. +3 −0 lib/path-manip.sh
  5. +2 −0 lib/scripting
  6. +2 −0 lib/set-shellname
  7. +2 −0 lib/tracefuncs
View
@@ -0,0 +1,15 @@
+[ -n "$ZSH_VERSION" ] && return 0
+if [ -n "$BASH_VERSION" ]; then
+ # TODO: Find a cleaner way to detect if bash is running as 'sh'.
+ ps $$ | grep bash >/dev/null 2>&1 && return 0
+fi
+
+echo "Attempt to run from some shell we don't (yet?) support."
+if type pstree >/dev/null 2>&1; then
+ pstree -h
+else
+ ps ajhf
+fi
+return 1
+
+# vim:ft=sh
View
@@ -1,3 +1,5 @@
+source ~/.../lib/assert-decent-shell || return
+
PATH="$HOME/.../bin:$PATH" # needed to bootsrap
eval `... env`
source ~/.../lib/tracefuncs
View
@@ -1,6 +1,8 @@
# This bash/zsh library contains useful functions for viewing and manipulating
# your PATH environment variable, and other similar environment variables.
+source ~/.../lib/assert-decent-shell || return
+
source ~/.../lib/tracefuncs
# List each directory in your PATH, one per line
View
@@ -1,5 +1,8 @@
# (Here for backwards compatibility. This is not actually a /bin/sh script, so
# the .sh name isn't quite right.)
+
+source ~/.../lib/assert-decent-shell || return
+
source ~/.../lib/path-manip
alias path-list=...path-list
alias path-remove=...path-remove
View
@@ -1,3 +1,5 @@
+source ~/.../lib/assert-decent-shell || return
+
source "$HOME/.../lib/tracefuncs"
function ...repo {
if [ -z "$1" ]; then
View
@@ -1,3 +1,5 @@
+source ~/.../lib/assert-decent-shell || return
+
if [ -n "$ZSH_VERSION" ]; then
export SHELLNAME=zsh
elif [ -n "$BASH_VERSION" ]; then
View
@@ -1,3 +1,5 @@
+source ~/.../lib/assert-decent-shell || return
+
function ...istracing {
[[ -n "$DOTDOTDOT_TRACE" ]]
}

0 comments on commit deeae4d

Please sign in to comment.