In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "java version for stderr output how to solve", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the problem of java version for stderr output.
Phenomenon
Today, write an initialization server script, want to get the java version, the result using java-version has been unable to use sed and awk processing, after experiments, found that
The java-version output is stderr and cannot be processed.
Test # output command 2 stderr and 1 stdout to the specified file to view the contents of the file Verify that the java-version output is stderr [root@template yum.repos.d] # java-version 2 > / tmp/java_version_stderr.out 1 > / tmp/java_ stdout.out [root @ template yum.repos.d] # cat / tmp/java_version_stderr.out openjdk version "1.8.0x181" OpenJDK Runtime Environment (build 1.8.0_181-b13) OpenJDK 64-Bit Server VM (build 25.181-b13) Mixed mode) [root@template yum.repos.d] # cat / tmp/java_stdout.out # you can see the java-version output as stderr So if we want to continue processing java-version output, we need to redirect to stdout solution java_ver= `java-version 2 > & 1 | sed '1javd' | sed's / "/ / g' | awk' {print $NF}'| awk-filler.'{print $1 $2}''so far, I believe you have a better understanding of" java version for stderr output ", you might as well do it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.