Hi Thien,

Ack with comments.

Regards, Vu

On 10/23/19 9:42 AM, thien.m.huynh wrote:
---
  scripts/tipc-config | 22 ++++++++++++----------
  1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/scripts/tipc-config b/scripts/tipc-config
index 34eb9a5..b7c6cef 100755
--- a/scripts/tipc-config
+++ b/scripts/tipc-config
@@ -36,10 +36,12 @@ EOF
      exit 1
  fi
+tipc=$(which tipc 2> /dev/null)
+
  while [ $# -gt 0 ]; do
      case "$1" in
        -addr)
-               addr=$(/sbin/tipc node get address)
+               addr=$($tipc node get address)
[Vu] Use double quotes around $tipc to avoid the case that having space(s) in the tipc path. So, use addr=$("$tipc" node get address). This comment is also applicable for below changes.
                hex_pattern="^[0-9a-fA-F]+$"
                if [[ $addr =~ $hex_pattern ]]; then
                        dec_addr=$((16#$addr))
@@ -53,36 +55,36 @@ while [ $# -gt 0 ]; do
                echo "node address: $addr"
            ;;
        -a=*)
-           /sbin/tipc node set address "$(echo "$1" | cut -d= -f2)"
+           $tipc node set address "$(echo "$1" | cut -d= -f2)"
            ;;
        -b)
            echo "Bearers:"
-           /sbin/tipc bearer list
+           $tipc bearer list
            ;;
        -bd=*)
-           /sbin/tipc bearer disable media eth device "$(echo "$1" | cut -d: 
-f2)"
+           $tipc bearer disable media eth device "$(echo "$1" | cut -d: -f2)"
            ;;
        -be=*)
-           /sbin/tipc bearer enable media eth device "$(echo "$1" | cut -d: 
-f2)"
+           $tipc bearer enable media eth device "$(echo "$1" | cut -d: -f2)"
            ;;
        -l)
            echo "Links:"
-           /sbin/tipc link list
+           $tipc link list
            ;;
        -lt=*)
            tolerance=$(echo "$1" | cut -d= -f2)
            link=$(echo "$tolerance" | cut -d/ -f1)
            value=$(echo "$tolerance" | cut -d/ -f2)
-           /sbin/tipc link set tolerance "$value" link "$link"
+           $tipc link set tolerance "$value" link "$link"
            ;;
        -netid)
-           echo "current network id: $(/sbin/tipc node get netid)"
+           echo "current network id: $($tipc node get netid)"
            ;;
        -netid=*)
-           /sbin/tipc node set netid "$(echo "$1" | cut -d= -f2)"
+           $tipc node set netid "$(echo "$1" | cut -d= -f2)"
            ;;
        -nt)
-           /sbin/tipc nametable show
+           $tipc nametable show
            ;;
        *)
            echo "$0: unrecognized option '$1'" 1>&2



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to