gorden5566 opened a new issue #3450:
URL: https://github.com/apache/rocketmq/issues/3450


   When I start nameserver on my Mac by the `mqnamesrv` script
   
   ```
   sh ./bin/mqnamesrv
   ```
   
   it raise an error
   
   ```
   sed: illegal option -- r
   usage: sed script [-Ealn] [-i extension] [file ...]
          sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file 
...]
   ```
   
   which lead to `JAVA_MAJOR_VERSION` always be empty,  in other words, it 
cannot recognize JDK gt than 1.8
   
   The reason is that `sed` on osx has no `-r` option
   
   We can test if the kernel is `Darwin`, and then decide how to get 
`JAVA_MAJOR_VERSION` by the result
   
   ```
   case "`uname`" in
       Darwin)
           JAVA_MAJOR_VERSION=$("$JAVA" -version 2>&1 | sed -E -n 's/.* version 
"([0-9]*).*$/\1/p')
       ;;
       *)
           JAVA_MAJOR_VERSION=$("$JAVA" -version 2>&1 | sed -r -n 's/.* version 
"([0-9]*).*$/\1/p')
       ;;
   esac
   ```
   
   What do you guys think?
   
   reference #2848 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to