bin/wrapper.sh: fix sed self exec
authorChris Larson <chris_larson@mentor.com>
Fri, 5 Nov 2010 20:15:51 +0000 (13:15 -0700)
committerChris Larson <chris_larson@mentor.com>
Fri, 5 Nov 2010 20:16:24 +0000 (13:16 -0700)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
bin/wrapper.sh

index 3a93475..d29d5b9 100644 (file)
@@ -2,6 +2,8 @@ path_remove () {
     echo $PATH | tr ':' '\n' | grep -v "^$1\$" | tr '\n' ':'
 }
 
+PATH="$(path_remove $(dirname $0))"
+
 quote(){
     sed -e "s,','\\\\'',g; 1s,^,',; \$s,\$,',;" << EOF
 $1
@@ -23,7 +25,5 @@ save () {
 
 exec_real () {
     eval set -- "$saved"
-    scriptdir="$(dirname $0)"
-    PATH="$(path_remove $scriptdir)"
     exec "$(basename $0)" "$@"
 }