]>
Commit | Line | Data |
---|---|---|
d1a0ec38 | 1 | #! /bin/sh |
d1a0ec38 | 2 | |
eac8a696 | 3 | # Copyright (C) 2004 Free Software Foundation, Inc. |
d1a0ec38 | 4 | # |
eac8a696 ZW |
5 | # This script is free software; the Free Software Foundation gives |
6 | # unlimited permission to copy, distribute and modify it. | |
d1a0ec38 | 7 | |
eac8a696 ZW |
8 | # Invoke a shell script with the same name two directories up from this |
9 | # file. Robust against all kinds of pathological file and directory | |
10 | # names, as well as all kinds of pathological shells. | |
11 | # By Nathanael Nerode, Zack Weinberg, and Alexandre Oliva. | |
d1a0ec38 | 12 | |
eac8a696 ZW |
13 | # Insert "../../" just before the last slash in the pathname. |
14 | # We use a here-document to avoid problems with "echo" and | |
15 | # pathnames containing backslashes or a leading dash. | |
d1a0ec38 | 16 | |
eac8a696 ZW |
17 | script=`sed 's,[^/]*$,../../&,' << EOF |
18 | $0 | |
d1a0ec38 | 19 | EOF |
eac8a696 | 20 | ` |
d1a0ec38 | 21 | |
eac8a696 ZW |
22 | # Must honor CONFIG_SHELL if set. |
23 | # Simple "$@" does the wrong thing for zero arguments with | |
24 | # OSF/1 4.0 /bin/sh, possibly others. | |
25 | # ${1+"$@"} does the wrong thing with zsh (== /bin/sh in | |
26 | # some iterations of Darwin). | |
d1a0ec38 | 27 | |
eac8a696 ZW |
28 | case $# in |
29 | 0) exec ${CONFIG_SHELL-/bin/sh} "$script" ;; | |
30 | *) exec ${CONFIG_SHELL-/bin/sh} "$script" "$@" ;; | |
d1a0ec38 MK |
31 | esac |
32 |