[X2Go-Commits] [x2goclient-contrib] 02/02: generate-timestamps-on-folder.sh: more quoting, fix slash detection.

git-admin at x2go.org git-admin at x2go.org
Thu Jun 7 07:52:33 CEST 2018


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

x2go pushed a commit to branch master
in repository x2goclient-contrib.

commit 5d94daed0f458883ee3228573205d391cc1ee4fc
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Jun 7 07:40:46 2018 +0200

    generate-timestamps-on-folder.sh: more quoting, fix slash detection.
---
 generate-timestamps-on-folder.sh | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/generate-timestamps-on-folder.sh b/generate-timestamps-on-folder.sh
index e434ea1..fabe05a 100755
--- a/generate-timestamps-on-folder.sh
+++ b/generate-timestamps-on-folder.sh
@@ -1,17 +1,19 @@
 #!/bin/bash
 
-if [ $# -eq 0 ]
-then
+if [[ "${#}" -eq '0' ]]; then
 	echo "Usage: ${0} directory-name (no trailing slash)"
-	exit
+	exit '1'
 fi
 
-if [[ ${1} == *"/"* ]]
-then
-	echo "Usage: ${0} directory-name (no trailing slash)"
-	exit
-fi
+case "${1}" in
+	(*"/"*)
+		echo "Usage: ${0} directory-name (no trailing slash)"
+		exit '2'
+		;;
+	(*)
+		;;
+esac
 
 # http://superuser.com/questions/513753/how-to-save-and-restore-files-created-modified-dates
-find ${1} -type f -exec stat -c 'touch --no-create -d "%y" "%n"' {} \; > ${1}_set-timestamps.sh
-chmod +x ${1}_set-timestamps.sh
+find "${1}" -type 'f' -exec stat -c 'touch --no-create -d "%y" "%n"' '{}' \; > "${1}_set-timestamps.sh"
+chmod +x "${1}_set-timestamps.sh"

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


More information about the x2go-commits mailing list