SC2039: In POSIX sh, echo flags are not supported.
echo -n is well supported but the changes are simple.
Improve some logic, replace some instances with printf. Who knew
printf was in POSIX?
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
start()
{
- echo -n "Starting ctdbd service: "
+ printf "Starting ctdbd service: "
case "$CTDB_INIT_STYLE" in
suse)
stop()
{
- echo -n "Shutting down ctdbd service: "
+ printf "Shutting down ctdbd service: "
case "$CTDB_INIT_STYLE" in
suse)
# that we get the maskbits as item #2 without further parsing.
while IFS="/$IFS" read _i _maskbits _x ; do
if [ "$_ip" = "$_i" ] ; then
- echo -n "$_ip "; ipv4_host_addr_to_net "$_ip" "$_maskbits"
+ printf "%s" "$_ip "; ipv4_host_addr_to_net "$_ip" "$_maskbits"
fi
done <"${CTDB_PUBLIC_ADDRESSES:-/dev/null}"
else
# Check multipath knows about the device
_out=$(multipath -ll "$_device")
if [ -z "$_out" ] ; then
- echo "device \"${_device}\" not known to multipathd" >"$multipath_fail"
+ echo "ERROR: device \"${_device}\" not known to multipathd" \
+ >"$multipath_fail"
exit 1
fi
# Check for at least 1 active path
if ! echo "$_out" | grep 'prio=.* status=active' >/dev/null 2>&1 ; then
- echo "multipath device \"${_device}\" has no active paths" >"$multipath_fail"
+ echo "ERROR: multipath device \"${_device}\" has no active paths" \
+ >"$multipath_fail"
exit 1
fi
done
if wait $_pid ; then
return 0
else
- echo -n "ERROR: "
cat "$multipath_fail"
rm -f "$multipath_fail"
return 1
ctdb_counter_incr () {
_ctdb_counter_common "$1"
- # unary counting!
- echo -n 1 >> "$_counter_file"
+ # unary counting using newlines!
+ echo >>"$_counter_file"
}
ctdb_counter_get () {
_ctdb_counter_common "$1"