Skip to content

Commit bdccc8c

Browse files
committed
update for osx readlink/ping diff from linux.
1 parent 6ed0a9a commit bdccc8c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bashrc/threads.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ _parse_options()
103103

104104
case ${#argv[@]} in
105105
2)
106-
g_HOST_LIST=$(readlink -f "${argv[0]}")
106+
command -v greadlink >/dev/null 2>&1 && g_HOST_LIST=$(greadlink -f "${argv[0]}") || g_HOST_LIST=$(readlink -f "${argv[0]}")
107107
g_CMD="${argv[1]}"
108108
;;
109109
0|*)
@@ -148,6 +148,7 @@ INDEX=0
148148

149149
while read -r HOST
150150
do
151+
HOST=${HOST#*(:space:)}
151152
(( INDEX++ ))
152153
fchar=`echo ${HOST} | cut -c -1`
153154

@@ -165,7 +166,7 @@ do
165166
_trace "[$INDEX] start ${HOST} ......"
166167
read <&9
167168

168-
ping -c 1 -w 3 ${HOST} &>/dev/null
169+
ping -c 1 -W 3 ${HOST} &>/dev/null
169170

170171
if [ $? -ne 0 ]; then
171172
_print_fatal "[$INDEX] Error: ${HOST} is unreachable."

0 commit comments

Comments
 (0)