[X2Go-Commits] [x2goserver] 17/17: x2goserver/bin/x2goversion: more curly braces, quotes etc.

git-admin at x2go.org git-admin at x2go.org
Fri Nov 16 03:47:06 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit 26a3e5436e13eb955ab0a032fb4a7e2ebcebdc7b
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Fri Nov 16 03:38:48 2018 +0100

    x2goserver/bin/x2goversion: more curly braces, quotes etc.
---
 debian/changelog           |  1 +
 x2goserver/bin/x2goversion | 28 +++++++++++++++-------------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b7fcabb..88ad5c4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -69,6 +69,7 @@ x2goserver (4.1.0.3-0x2go1) UNRELEASED; urgency=medium
     - x2goserver/bin/x2goruncommand: replace historical "egrep" with "grep
       -E".
     - x2goserver/bin/x2goversion: replace historical "egrep" with "grep -E".
+    - x2goserver/bin/x2goversion: more curly braces, quotes etc.
   * x2goserver.spec:
     + Pull in openSUSE-release manually on OpenSuSE Tumbleweed to work around
       a bug.
diff --git a/x2goserver/bin/x2goversion b/x2goserver/bin/x2goversion
index 35f012d..fbe76f4 100755
--- a/x2goserver/bin/x2goversion
+++ b/x2goserver/bin/x2goversion
@@ -19,32 +19,34 @@
 # Free Software Foundation, Inc.,
 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
-X2GO_LIB_PATH="$(x2gopath libexec)";
+X2GO_LIB_PATH="$(x2gopath 'libexec')"
 
-$X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@"
+"${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "$(basename "${0}") called with options: ${@}"
 
-X2GO_VERSIONS_BASEPATH="$(dirname $0)/../share/x2go/versions"
+X2GO_VERSIONS_BASEPATH="$(dirname "${0}")/../share/x2go/versions"
 
 get_version() {
-	cat "$1" | grep -Ev "^#.*" | head -n1 | cut -d" " -f1
+	grep -Ev "^#.*" "${1}" | head -n '1' | cut -d ' ' -f '1'
 }
 
-if [ -n "$1" ]; then
-	X2GO_COMPONENT="$1"
+if [ -n "${1}" ]; then
+	X2GO_COMPONENT="${1}"
 	X2GO_COMPONENT_VERFILE="${X2GO_VERSIONS_BASEPATH}/VERSION.${X2GO_COMPONENT}"
 
 	if [ -f "${X2GO_COMPONENT_VERFILE}" ]; then
-		echo "$(get_version ${X2GO_COMPONENT_VERFILE})"
+		echo "$(get_version "${X2GO_COMPONENT_VERFILE}")"
 	else
-		echo "Version information for X2Go component '$X2GO_COMPONENT' is not available." >&1
-		exit 1
+		echo "Version information for X2Go component '${X2GO_COMPONENT}' is not available." >&1
+		exit '1'
 	fi
 else
 	cd "${X2GO_VERSIONS_BASEPATH}"
-	for compfile in `ls "${X2GO_VERSIONS_BASEPATH}"`; do
-		X2GO_COMPONENT="$(echo $compfile | cut -d"." -f2)"
-		X2GO_COMPONENT_VERSION="$(get_version $compfile)"
+	for compfile in "${X2GO_VERSIONS_BASEPATH}"/*; do
+		X2GO_COMPONENT="$(echo "${compfile}" | cut -d '.' -f '2')"
+		X2GO_COMPONENT_VERSION="$(get_version "${compfile}")"
 		echo "${X2GO_COMPONENT}: ${X2GO_COMPONENT_VERSION}"
 	done
-	cd - >/dev/null
+	cd '-' >'/dev/null'
 fi
+
+exit '0'

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list