chiark / gitweb /
found
[ian-dotfiles.git] / scripts / xr
diff --git a/scripts/xr b/scripts/xr
new file mode 100755 (executable)
index 0000000..b92ce58
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -e
+leaves=""
+while ! cd Build 2>/dev/null; do
+    cwd="$(pwd)"
+    leaf="${cwd##*/}"
+    if test -z "$leaf"; then echo >&2 'xr: no Build found'; break; fi
+    leaves="$leaf/$leaves"
+    cd ..
+done
+
+exec x -e \
+really -u rustcargo \
+env - PATH=/usr/local/bin:/usr/bin:/bin HOME=/home/rustcargo \
+      $(env | egrep '^LC_|^LANG=|^LANGUAGE=|^TERM=|^LESS=|^PAGER=') \
+bash --login -ec 'cd "$@"; exec bash' x "$(pwd)/$leaves"