From: Yan, Zheng Date: Thu, 23 Jul 2015 02:58:05 +0000 (+0800) Subject: init-ceph: replace 'echo -n' with printf X-Git-Tag: v9.1.0~259^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=69e2060f170855d1131d33786aab22287fe23d51;p=ceph.git init-ceph: replace 'echo -n' with printf 'echo -n' is no portable. On OSX, output of 'echo -n' can be '-n' Signed-off-by: Yan, Zheng --- diff --git a/src/ceph_common.sh b/src/ceph_common.sh index 07faddc2fce..0a4ac229f5b 100644 --- a/src/ceph_common.sh +++ b/src/ceph_common.sh @@ -220,10 +220,10 @@ get_conf() { if [ -z "$1" ]; then [ "$verbose" -eq 1 ] && echo "$CCONF -c $conf -n $type.$id \"$key\"" - eval "$var=\"`$CCONF -c $conf -n $type.$id \"$key\" || eval echo -n \"$def\"`\"" + eval "$var=\"`$CCONF -c $conf -n $type.$id \"$key\" || printf \"$def\"`\"" else [ "$verbose" -eq 1 ] && echo "$CCONF -c $conf -s $1 \"$key\"" - eval "$var=\"`$CCONF -c $conf -s $1 \"$key\" || eval echo -n \"$def\"`\"" + eval "$var=\"`$CCONF -c $conf -s $1 \"$key\" || eval printf \"$def\"`\"" fi } diff --git a/src/init-ceph.in b/src/init-ceph.in index 3e3b3a44cd5..82a4fd5e889 100755 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -59,12 +59,12 @@ signal_daemon() { signal=$4 action=$5 [ -z "$action" ] && action="Stopping" - echo -n "$action Ceph $name on $host..." + printf "$action Ceph $name on $host..." do_cmd "if [ -e $pidfile ]; then pid=`cat $pidfile` if [ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline ; then cmd=\"kill $signal \$pid\" - echo -n \$cmd... + printf \"\$cmd...\" \$cmd fi fi" @@ -89,12 +89,12 @@ stop_daemon() { signal=$4 action=$5 [ -z "$action" ] && action="Stopping" - echo -n "$action Ceph $name on $host..." + printf "$action Ceph $name on $host..." do_cmd "if [ -e $pidfile ] ; then pid=\`cat $pidfile\` while [ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline ; do cmd=\"kill $signal \$pid\" - echo -n \$cmd... + printf \"\$cmd...\" \$cmd sleep 1 continue @@ -428,7 +428,7 @@ for name in $what; do status) if daemon_is_running $name ceph-$type $id $pid_file; then - echo -n "$name: running " + printf "$name: running " do_cmd "$BINDIR/ceph --admin-daemon $asok version 2>/dev/null" || echo unknown elif [ -e "$pid_file" ]; then # daemon is dead, but pid file still exists