Revision: 19695
          http://sourceforge.net/p/edk2/code/19695
Author:   yzhu52
Date:     2016-01-20 05:12:02 +0000 (Wed, 20 Jan 2016)
Log Message:
-----------
BaseTools: Improve shell wrapper for C build commands

- Avoid obsolescent forms of test builtin (`-a` and `-o`; see APPLICATION USAGE
  section of 
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html).
- Quote all expansions to prevent string-splitting and globbing.
- Avoid unspecified "exit -1" (only single-byte integers are valid); instead,
  use identical exit status to shell command-not-found.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Charles Duffy <[email protected]>
Reviewed-by: Yonghong Zhu <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BootSectImage
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiLdrImage
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiRom
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenCrc32
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFfs
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFv
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFw
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenPage
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenSec
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenVtf
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GnuGenBootSector
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaCompress
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Split
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TianoCompress
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VfrCompile
    trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VolInfo
    trunk/edk2/BaseTools/BinWrappers/PosixLike/BootSectImage
    trunk/edk2/BaseTools/BinWrappers/PosixLike/EfiLdrImage
    trunk/edk2/BaseTools/BinWrappers/PosixLike/EfiRom
    trunk/edk2/BaseTools/BinWrappers/PosixLike/GenCrc32
    trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFfs
    trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFv
    trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFw
    trunk/edk2/BaseTools/BinWrappers/PosixLike/GenPage
    trunk/edk2/BaseTools/BinWrappers/PosixLike/GenSec
    trunk/edk2/BaseTools/BinWrappers/PosixLike/GenVtf
    trunk/edk2/BaseTools/BinWrappers/PosixLike/GnuGenBootSector
    trunk/edk2/BaseTools/BinWrappers/PosixLike/LzmaCompress
    trunk/edk2/BaseTools/BinWrappers/PosixLike/Split
    trunk/edk2/BaseTools/BinWrappers/PosixLike/TianoCompress
    trunk/edk2/BaseTools/BinWrappers/PosixLike/VfrCompile
    trunk/edk2/BaseTools/BinWrappers/PosixLike/VolInfo

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BootSectImage
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BootSectImage   2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BootSectImage   2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiLdrImage
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiLdrImage     2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiLdrImage     2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiRom
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiRom  2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiRom  2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenCrc32
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenCrc32        2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenCrc32        2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFfs
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFfs  2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFfs  2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFv
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFv   2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFv   2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFw
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFw   2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFw   2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenPage
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenPage 2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenPage 2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenSec
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenSec  2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenSec  2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenVtf
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenVtf  2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenVtf  2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GnuGenBootSector
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GnuGenBootSector        
2016-01-20 05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GnuGenBootSector        
2016-01-20 05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaCompress
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaCompress    2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaCompress    2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Split
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Split   2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Split   2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TianoCompress
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TianoCompress   2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TianoCompress   2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VfrCompile
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VfrCompile      2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VfrCompile      2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VolInfo
===================================================================
--- trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VolInfo 2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VolInfo 2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/BootSectImage
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/BootSectImage    2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/BootSectImage    2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/EfiLdrImage
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/EfiLdrImage      2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/EfiLdrImage      2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/EfiRom
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/EfiRom   2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/EfiRom   2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/GenCrc32
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/GenCrc32 2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/GenCrc32 2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFfs
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFfs   2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFfs   2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFv
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFv    2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFv    2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFw
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFw    2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/GenFw    2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/GenPage
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/GenPage  2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/GenPage  2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/GenSec
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/GenSec   2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/GenSec   2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/GenVtf
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/GenVtf   2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/GenVtf   2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/GnuGenBootSector
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/GnuGenBootSector 2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/GnuGenBootSector 2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/LzmaCompress
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/LzmaCompress     2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/LzmaCompress     2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/Split
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/Split    2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/Split    2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/TianoCompress
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/TianoCompress    2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/TianoCompress    2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/VfrCompile
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/VfrCompile       2016-01-20 
05:09:06 UTC (rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/VfrCompile       2016-01-20 
05:12:02 UTC (rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 

Modified: trunk/edk2/BaseTools/BinWrappers/PosixLike/VolInfo
===================================================================
--- trunk/edk2/BaseTools/BinWrappers/PosixLike/VolInfo  2016-01-20 05:09:06 UTC 
(rev 19694)
+++ trunk/edk2/BaseTools/BinWrappers/PosixLike/VolInfo  2016-01-20 05:12:02 UTC 
(rev 19695)
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
-#exec `dirname $0`/../../../../C/bin/`basename $0` $*
 
-TOOL_BASENAME=`basename $0`
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
 
-if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
 then
-  exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
-elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
 then
-  if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
   then
-    echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
-    echo You may need to run:
+    echo "BaseTools C Tool binary was not found ($cmd)"
+    echo "You may need to run:"
     echo "  make -C $EDK_TOOLS_PATH/Source/C"
   else
-    exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+    exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
   fi
-elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
 then
-  exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+  exec "$dir/../../Source/C/bin/$cmd" "$@"
 else
-  echo Unable to find the real \'$TOOL_BASENAME\' to run
-  echo This message was printed by
+  echo "Unable to find the real '$cmd' to run"
+  echo "This message was printed by"
   echo "  $0"
-  exit -1
+  exit 127
 fi
 


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to