
On Fri, Oct 16, 2020 at 10:31:29AM +0800, Wu Fengguang wrote:
+get_port()
=> set_port
Ok
+{ + [ -n "$uuid" ] || return
blank line here
Let's convert to new my_xxx variable names for user_name, uuid, etc.
Ok, I got it.
+ for i in $(seq 1 10) + do + port=$(($(date +%s%N)%"$sshr_port_len"+"$sshr_port_base")) + ssh -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes -o TCPKeepAlive=yes \ + -Nf -R $port:localhost:22 sshr@"$sshr_ip" -p "$sshr_port" &>/dev/null
+ [ $? -eq 0 ] || continue + return
continue/return can be merged to
&& return
Good idea!!! Thanks, Yale
+ done + port="" +} + run_email() { - [ -n "$email" ] || return 0 + [ -n "$email" ] && [ -n "$uuid" ] || return 0 + user_name=$(echo "$email" | awk -F '@' '{print $1}') compose_email - curl -XPOST "$MAIL_HOST:$MAIL_PORT/send_mail_text" -d "$data" + curl -XPOST "${MAIL_HOST:-$LKP_SERVER}:${MAIL_PORT:-11312}/send_mail_text" -d "$data" }
run_ssh +get_port +report_ssh_port $port run_email -- 2.23.0