public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v3 1/6] edksetup.sh: Use bash variable $PWD instead of executing pwd command
@ 2019-07-16 16:53 rebecca
  2019-07-16 16:53 ` [PATCH v3 2/6] edksetup.sh: Use $SCRIPTNAME consistently instead of 'edksetup.sh' rebecca
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rebecca @ 2019-07-16 16:53 UTC (permalink / raw)
  To: devel, lersek, bob.c.feng, liming.gao, leif.lindholm,
	michael.d.kinney, afish
  Cc: Rebecca Cran

This is a (very minor) optimization: `pwd` runs the command (even as a
built-in), whereas $PWD simply evaluates the value of the variable.

ALso, modern scripts should generally use $(...) to run commands,
instead of `...`.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 edksetup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/edksetup.sh b/edksetup.sh
index 12a3e26a67..ab58fe4a6e 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -71,7 +71,7 @@ function SetWorkspace()
   #
   # Set $WORKSPACE
   #
-  export WORKSPACE=`pwd`
+  export WORKSPACE=$PWD
   return 0
 }
 
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/6] edksetup.sh: Use $SCRIPTNAME consistently instead of 'edksetup.sh'
  2019-07-16 16:53 [PATCH v3 1/6] edksetup.sh: Use bash variable $PWD instead of executing pwd command rebecca
@ 2019-07-16 16:53 ` rebecca
  2019-07-16 16:53 ` [PATCH v3 3/6] edksetup.sh: when executing arithmetic commands, $ isn't needed rebecca
  2019-07-16 16:53 ` [PATCH v3 4/6] edksetup.sh: remove redundant -?, -h and --help in options parsing rebecca
  2 siblings, 0 replies; 4+ messages in thread
From: rebecca @ 2019-07-16 16:53 UTC (permalink / raw)
  To: devel, lersek, bob.c.feng, liming.gao, leif.lindholm,
	michael.d.kinney, afish
  Cc: Rebecca Cran

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 edksetup.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/edksetup.sh b/edksetup.sh
index ab58fe4a6e..752e47e7cb 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -49,11 +49,11 @@ function SetWorkspace()
     return 0
   fi
 
-  if [ ! ${BASH_SOURCE[0]} -ef ./edksetup.sh ] && [ -z "$PACKAGES_PATH" ]
+  if [ ! ${BASH_SOURCE[0]} -ef ./$SCRIPTNAME ] && [ -z "$PACKAGES_PATH" ]
   then
     echo Run this script from the base of your tree.  For example:
     echo "  cd /Path/To/Edk/Root"
-    echo "  . edksetup.sh"
+    echo "  . $SCRIPTNAME"
     return 1
   fi
 
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 3/6] edksetup.sh: when executing arithmetic commands, $ isn't needed
  2019-07-16 16:53 [PATCH v3 1/6] edksetup.sh: Use bash variable $PWD instead of executing pwd command rebecca
  2019-07-16 16:53 ` [PATCH v3 2/6] edksetup.sh: Use $SCRIPTNAME consistently instead of 'edksetup.sh' rebecca
@ 2019-07-16 16:53 ` rebecca
  2019-07-16 16:53 ` [PATCH v3 4/6] edksetup.sh: remove redundant -?, -h and --help in options parsing rebecca
  2 siblings, 0 replies; 4+ messages in thread
From: rebecca @ 2019-07-16 16:53 UTC (permalink / raw)
  To: devel, lersek, bob.c.feng, liming.gao, leif.lindholm,
	michael.d.kinney, afish
  Cc: Rebecca Cran

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 edksetup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/edksetup.sh b/edksetup.sh
index 752e47e7cb..76c8d7916e 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -199,7 +199,7 @@ do
       break
     ;;
   esac
-  I=$(($I - 1))
+  I=$((I - 1))
 done
 
 if [ $I -gt 0 ]
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 4/6] edksetup.sh: remove redundant -?, -h and --help in options parsing
  2019-07-16 16:53 [PATCH v3 1/6] edksetup.sh: Use bash variable $PWD instead of executing pwd command rebecca
  2019-07-16 16:53 ` [PATCH v3 2/6] edksetup.sh: Use $SCRIPTNAME consistently instead of 'edksetup.sh' rebecca
  2019-07-16 16:53 ` [PATCH v3 3/6] edksetup.sh: when executing arithmetic commands, $ isn't needed rebecca
@ 2019-07-16 16:53 ` rebecca
  2 siblings, 0 replies; 4+ messages in thread
From: rebecca @ 2019-07-16 16:53 UTC (permalink / raw)
  To: devel, lersek, bob.c.feng, liming.gao, leif.lindholm,
	michael.d.kinney, afish
  Cc: Rebecca Cran

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 edksetup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/edksetup.sh b/edksetup.sh
index 76c8d7916e..06d2f041e6 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -194,7 +194,7 @@ do
       RECONFIG=TRUE
       shift
     ;;
-    -?|-h|--help|*)
+    *)
       HelpMsg
       break
     ;;
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-16 16:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-16 16:53 [PATCH v3 1/6] edksetup.sh: Use bash variable $PWD instead of executing pwd command rebecca
2019-07-16 16:53 ` [PATCH v3 2/6] edksetup.sh: Use $SCRIPTNAME consistently instead of 'edksetup.sh' rebecca
2019-07-16 16:53 ` [PATCH v3 3/6] edksetup.sh: when executing arithmetic commands, $ isn't needed rebecca
2019-07-16 16:53 ` [PATCH v3 4/6] edksetup.sh: remove redundant -?, -h and --help in options parsing rebecca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox