summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2017-02-22 14:44:09 +1100
committerMartin Schwenke <martins@samba.org>2017-02-24 07:47:11 +0100
commit1c8a3988eed5f35462fbd438b5d2e0637117ad4e (patch)
tree08c52b1717474204f751fa2ac04908d31f00dbb4 /ctdb
parent8c21aac77fe9e7eaa0cd99099330b3be081c8101 (diff)
downloadsamba-1c8a3988eed5f35462fbd438b5d2e0637117ad4e.tar.gz
ctdb-doc: Fix shellcheck warning in example NFS ganesha call-out
In ctdb/doc/examples/nfs-ganesha-callout line 216: for node in `ls ${GANSTATEDIR}`; do ^-- SC2045: Iterating over ls output is fragile. Use globs. ^-- SC2006: Use $(..) instead of legacy `..`. ^-- SC2086: Double quote to prevent globbing and word splitting. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/doc/examples/nfs-ganesha-callout18
1 files changed, 12 insertions, 6 deletions
diff --git a/ctdb/doc/examples/nfs-ganesha-callout b/ctdb/doc/examples/nfs-ganesha-callout
index ac966991a17..283f20482ae 100755
--- a/ctdb/doc/examples/nfs-ganesha-callout
+++ b/ctdb/doc/examples/nfs-ganesha-callout
@@ -213,12 +213,18 @@ create_ganesha_recdirs ()
mkdir -p "$GANSTATEDIR"
check_ln "$NODESTATEDIR" "$NODESTATELN"
- for node in `ls ${GANSTATEDIR}`; do
- if [ "${node}" != "${host}" ]; then
- check_ln "${GANSTATEDIR}/${node}/ganesha" \
- "${NODESTATEDIR}/ganesha/${node}"
- check_ln "${GANSTATEDIR}/${node}/statd" \
- "${NODESTATEDIR}/statd/${node}"
+ for _dir in "${GANSTATEDIR}/"* ; do
+ # Handle no directories case
+ if [ ! -d "$_dir" ] ; then
+ break
+ fi
+
+ _node="${_dir##*/}" # basename
+ if [ "${_node}" != "${host}" ]; then
+ check_ln "${GANSTATEDIR}/${_node}/ganesha" \
+ "${NODESTATEDIR}/ganesha/${_node}"
+ check_ln "${GANSTATEDIR}/${_node}/statd" \
+ "${NODESTATEDIR}/statd/${_node}"
fi
done
;;